PostgreSQL复制表结构及数据:
①.复制表结构及数据(新表不用先建好):
CREATE TABLE tab_new AS SELECT * FROM tab_old
②.创建无日志表和复制数据(新表不用先建好):
create unlogged table t_unlog as select * from t_log where id=xxx ;
③.复制表结构及数据(新表不用先建好):
SELECT * INTO t_risk_new FROM t_risk_old where id='xxx';
④.新表已存在:
insert INTO tab_new select * FROM tab_old where id='xx';
12-29
1499
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-03
1169
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交