1.在创建表时复制
create table table_name
as select column1,column2,...... from old_table;
例:
create table userinfo2
as select name,num from userinfo;
若要复制全部数据,select * 即可
create table userinfo2
as select * from userinfo;
2.对已经创建的表复制数据
insert into table_name
(column1,column2,......)
select column1,column2 from old_table;
复制全部数据:
insert into table_name
select * from old_table;
说明:
1.对已存在表复制时,字段名必须存在。
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------学习记录,都是基本知识------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------------------------------------------------------------