Snowpark Migration Accelerator: 값

설명

쿼리 내에 즉시 사용할 수 있는 임시 테이블을 생성합니다. 자세한 내용은 Databricks SQL Language Reference VALUES 를 참조하십시오.

SELECT 문의 FROM 절에 있는 VALUES 하위 절을 사용하면 특정 수의 행을 생성하기 위해 수정된 값 세트를 정의할 수 있습니다. (Snowflake SQL Language Reference VALUES)

구문

VALUES {expression | ( expression [, ...] ) } [, ...] [table_alias]

SELECT expression [, ...] [table_alias]
Copy
SELECT ...
FROM ( VALUES ( <expr> [ , <expr> [ , ... ] ] ) [ , ( ... ) ] ) [ [ AS ] <table_alias> [ ( <column_alias> [, ... ] ) ] ]
[ ... ]
Copy

샘플 소스 패턴

설정 데이터

Databricks

CREATE TEMPORARY VIEW number1(c) AS VALUES (3), (1), (2), (2), (3), (4);
Copy

Snowflake

CREATE TEMPORARY TABLE number1(c int);
INSERT INTO number1 VALUES (3), (1), (2), (2), (3), (4);
Copy

패턴 코드

Databricks

-- single row, without a table alias
> VALUES ("one", 1);
  one    1

-- Multiple rows, one column
> VALUES 1, 2, 3;
 1
 2
 3

-- three rows with a table alias
> SELECT data.a, b
    FROM VALUES ('one', 1),
                ('two', 2),
                ('three', NULL) AS data(a, b);
   one    1
   two    2
 three NULL

-- complex types with a table alias
> SELECT a, b
  FROM VALUES ('one', array(0, 1)),
              ('two', array(2, 3)) AS data(a, b);
 one [0, 1]
 two [2, 3]

-- Using the SELECT syntax
> SELECT 'one', 2
 one 2
Copy

c

3

1

2

4

Snowflake

-- single row, without a table alias
SELECT * FROM (VALUES ('one', 1));

-- Multiple rows, one column
SELECT * FROM (VALUES (1), (2), (3));

-- three rows with a table alias
SELECT a, b
    FROM (VALUES ('one', 1),
                ('two', 2),
                ('three', NULL)) AS data(a, b);

-- complex types with a table alias
SELECT a, b 
    FROM 
    (VALUES ('one', '[0, 1]'), 
            ('two', '[2, 3]')
            ) AS data(a, b);

-- Using the SELECT syntax
SELECT 'one', 2
Copy

c

3

1

2

4

Known Issues

발견된 문제 없음