highgo=# select * from test;
id
------
1
1
1
1
1
100
200
300
400
400
1000
2000
3000
3000
3000
1
(16 rows)
highgo=# create table testa as select * from test; -此方式即有表结构又包含数据
SELECT 16
highgo=# create table testb (like test); --此方式仅创建表结构,没有数据
CREATE TABLE
highgo=#
highgo=# select * from testa;
id
------
1
1
1
1
1
100
200
300
400
400
1000
2000
3000
3000
3000
1
(16 rows)
highgo=# select * from testb;
id
----
(0 rows)
highgo=# create table testc as select * from test with no data; ---此
id
------
1
1
1
1
1
100
200
300
400
400
1000
2000
3000
3000
3000
1
(16 rows)
highgo=# create table testa as select * from test; -此方式即有表结构又包含数据
SELECT 16
highgo=# create table testb (like test); --此方式仅创建表结构,没有数据
CREATE TABLE
highgo=#
highgo=# select * from testa;
id
------
1
1
1
1
1
100
200
300
400
400
1000
2000
3000
3000
3000
1
(16 rows)
highgo=# select * from testb;
id
----
(0 rows)
highgo=# create table testc as select * from test with no data; ---此