mysql中表copy中的几种方法
1、方式1:
CREATE TABLE new_staff LIKE staff;

2、copy表,包括表结构和索引
但不会copy源表的数据

3、方式2:
create table new2_staff as (select * from staff);

4、copy表结构,包括数据,但索引,主键不会copy

5、有没有发现,create table 新表名 as 后面是 一个selelct 语句
因此
新表中可以只包括新表中部分字段
命令:
create table new2_staff as (select id,current_ from staff);

6、新表中只包括源表中的部分数据
命令:
create table new5_staff as (select * from staff where right(id,1)<5);
只复制5条数据

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:101
阅读量:93
阅读量:174
阅读量:160
阅读量:43