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