• [织梦吧]唯一域名:www.dedecms8.com,织梦DedeCMS学习平台.

当前位置: > 编程与数据库 > mysql教程 >

select into from与insert into select区别

来源: www.dedecms8.com 编辑:织梦吧 时间:2013-10-17点击:

select into from与insert into select区别,本文操作环境为sql2500

先看一下insert into select语句,语法形式为:Insert into Table2(field1,field2,...) select value1,value2,... from Table1。 select into from与insert into select区别详解

Table2必须已经存在,如果不存在,系统则会提示对象无效。 select into from与insert into select区别详解

因为Table2已经存在,所以可以任意的向Table2中加入符合列类型的内容,当然也包括常量,也许通过下面的图,你就会发现,在导入常量时候的不寻常现象。 select into from与insert into select区别详解

接下来说一下select into from 语句,该语法形式为:SELECT vale1, value2 into Table2 from Table1。 select into from与insert into select区别详解

这里要求的是MyTable1不存在,因为在插入的时候,系统会自动创建MyTable1,如果之前MyTable1已经被创建,系统就会提示已经存在表。 select into from与insert into select区别详解

就是因为这个特性,就会给我们带来很多的方便,首先,我如果只想要MyTable2表中的ID列的话那我只需要将ID列select出来,然后加入到新表中即可。 select into from与insert into select区别详解

那如果我想要MyTable2中的Name列,那我也仅仅是需要把Name列select出来,然后添加到新表中即可。 select into from与insert into select区别详解  

标签: select insert

About D8

  • ©2014 织梦吧(d8) DedeCMS学习交流平台
  • 唯一网址 www.DedeCMS8.com 网站地图
  • 联系我们 1170734538@qq.com ,  QQ