08-MySQL复制表操作

222 阅读1分钟
  • 复制表结构和表数据
create table staff2 -- 新表
as
select * from staff -- 原表

  • 只复制表结构, 不复制表数据
create table staff2 -- 新表
as
select * from staff where 1 = 2 -- 原表

  • 复制部门结构和数据
create table staff2 -- 新表
as
select sname, email from staff where sname = '张三' -- 原表