如有有表A,要复制到表B
1、表结构和数据一起复制
create table B as select * from A;
2、只复制表结构
create table B as select * from A where 1=2;
3、把数据从A复制到B
先建表B, 然后
insert into B select * from A;
4、只复制部分数据
insert into B select * from A where ...;
insert into B (ID, name,...) select ID, name,... from A;
--对于表的约束是复制不了的,需要自己去添加。
阅读(698) | 评论(0) | 转发(0) |