MySql中,复制旧表结构到新表

# 创建学生表

create table student(age int,name varchar(32))engine myisam charset utf8;
insert into student values(18,'小白');

# 创建教师表,结构与学生表结构一模一样
create table teacher like student;

# 把学生表的数据写进教师表中
insert into teacher select * from student;

# 创建家长表,结构与数据与学生表一模一样
create table parent select * from student;

#创建学校表,结构与学生表一样
create table school select * from student where 1 = 2;#即条件不成立

 

 

posted @ 2016-06-24 18:42  D蓝叶  阅读(883)  评论(0编辑  收藏  举报