根据已有表创建新表

通用

1
2
3
create table tb(id serial, name varchar(10));
insert into tb(name) values('a'),('b'),('c');
create table tb2 as select * from tb;

PG

1
2
select * into tb3 from tb;
create table tb4 (like tb); --只创建表结构