如何将数据插入到Snowflake数据库的临时表中。我已经创建了一个DDL:创建临时表table_name作为Select

时间:2019-09-04 12:08:03

标签: snowflake-data-warehouse

如何在Snowflake数据库的Temporary表中插入数据? 我已经创建了一个如下表:

CREATE TEMPORARY TABLE mydata.name as

1 个答案:

答案 0 :(得分:0)

这里有一些例子应该有所帮助。

--create a seed table
CREATE TABLE t1 (id NUMBER, str VARCHAR(100)); 

--add records to seed table
INSERT into t1 values (1, 'Rich'), (2, 'Murnane'); 

--this creates the temp table and adds the two records
CREATE TEMPORARY TABLE t2 AS SELECT id, str FROM t1; 

--this adds additional records, with slightly different data
INSERT INTO t2 SELECT -1 * id, '~'||str||'~' FROM t1; 

--this will show you your four records
SELECT * FROM t2;

ID  STR
1   Rich
2   Murnane
-1  ~Rich~
-2  ~Murnane~