­

同实例下复制表的2种方法

  • 2019 年 10 月 4 日
  • 筆記

很简单的方法,可以略过。

需求:

在test库下创建表,要求导入hellodb.students的数据。

方法1:

use test;

create table t2 as select * from hellodb.students;

方法2:

use test;

create table t1 like hellodb.students;

insert into t1 select * from hellodb.students;

方法2的效果更好,具体可以看下图。