Mysql如何复制一张表

1.复制表数据和结构

create table new_table_name select * from table_name;

 

  new_table_name  新表

  table_name 源表

2.只复制表结构

create table new_table_name like  table_name;

  new_table_name  新表

  table_name 源表

3.只拷贝数据

  

insert into new_table_name select * from table_name;
new_table_name  新表
table_name  源表


ps: 1.不会复制索引(包括主键)

posted on 2020-01-07 18:04  指尖,写不尽  阅读(422)  评论(0编辑  收藏  举报

导航