一、SQL查询数据并插入新表
create table newtable as select * from oldtable;
创建一个新表newtable,newtable的表结构、数据与oldtable是一样的。
需要注意的是,新表newtable不会保留oldtable的约束关系(包括主键等)
二、SQL创建具有相同表结构的新表
create table newtable as select * from oldtable where 1=0;
创建一个新表newtable ,newtable的表结构与oldtable是一样的,但没有数据,且不保留oldtable的约束关系。