select into from与insert into select区别

方法一:在mysql中用select into from一直报错,

select into from与insert into select区别

错误:1327 - Undeclared variable: score

select into from要求目标表target_table不存在,因为在插入时会自动创建

后来在网上看资料说Mysql不支持select into from语句,所以用其他方法来替代select into from语句:

create table score1 (select num from student);

select into from与insert into select区别

查询表score1:

select into from与insert into select区别     

  方法二:INSERT INTO table_1 (SELECT * FROM table_2)

  把table_2数据转存到table_1,此方法适合table_1已经创建的。

select into from与insert into select区别

select into from与insert into select区别