文章目录
提示:现在的数据库操作工具,基本上能满足日常开发所需,但是sql还是有必要学习一下
一、复制表
1.复制表结构和全部数据
create table t_student_info_20220930_01 as select * from t_student_info;
2.复制部分列和部分列数据
create table t_student_info_20220930_02 as select id,name from t_student_info;
3.只复制表结构
create table t_student_info_20220930_03 as select * from t_student_info where 1=2;
4.只复制部分列
create table t_student_info_20220930_04 as select id,name from t_student_info where 1=2;
以上sql不支持主键和索引的复制,navicat的复制表结构和数据已经很好地支持了