如何将主键添加到create as query语句?我尝试了以下但它抛出了一个错误。当我取出主键部分时,此查询可以正常工作:
--redshift statement
DROP TABLE IF EXISTS egtable;
CREATE TEMPORARY TABLE egtable
primary key (id),sortkey (b)
as
select 1 as id, 2 as b;
答案 0 :(得分:0)
你会想要这样的东西:
DROP TABLE IF EXISTS egtable;
CREATE TEMPORARY TABLE egtable
(
id int,
b int,
primary key (id)
)
distkey(b);
insert into egtable select 1, 2