postgresql 通过一个表创建一个新表
PG根据已有表建立新表
AS(通用)PG特有
AS(通用)
create table test(id serial, name varchar(10)); insert into test(name) values('a'),('b'),('c'); create table test2 as select * from test;
PG特有
-- 注意,test3应该是还没创建的新表
select * into test3 from test;
create table test_t2 (like test_t1); --只创建表结构