怎样在mysql中复制一个数据表,重新修改名称后,生成一个新表。新表中的内容和原来的数据表一样,而且主键值也不变。
哪位大侠帮帮忙,分数多多的给

解决方案 »

  1.   

    最好使用java语句来完成的
    分数不够再加
      

  2.   

    create table tb_NewName as
    select * from tb_OldName;alter table tb_NewName add  primary key (要建立主键的列);
      

  3.   

    create table `new_table` like `old_table`;
    insert into  `new_table` select * from `old_table`;
      

  4.   

    create table 新表 as
    select * from 老表;alter table 新表 add  primary key (主键的列);
      

  5.   

    在navicat里面,用鼠标拖动下就好了;有两种选择,一种是复制所有的数据,一种是只复制表的结构!