表的复制语句: select into 和 insert into select

来源:互联网 发布:淘宝上的avada主题 编辑:程序博客网 时间:2024/05/17 07:48

select into

SELECT vale1, value2 into Table2 from Table1

要求目标表Table2不存在,因为在插入时会自动创建表Table2

insert into select

Insert into Table2(field1,field2,…) select value1,value2,… from Table1

要求目标表Table2必须存在,因此 这种情况下 可以插入常量,
或者table2中有auto_increament关键字

0 0