亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

數(shù)據(jù)庫(kù)插入數(shù)據(jù)之select into from與insert into select區(qū)別詳解

 更新時(shí)間:2014年01月11日 19:06:30   投稿:mdxy-dxy  
能第一次接觸select...into...from...和insert into...select...有很多人都會(huì)誤解, 從表面上看都是把相關(guān)信息查詢出來(lái),然后添加到一個(gè)表里,其實(shí)還遠(yuǎn)遠(yuǎn)沒有這么簡(jiǎn)單,接下來(lái),小豬就用最普通的表述給大家介紹一下這兩者間的區(qū)別

可能第一次接觸select...into...from...和insert into...select...有很多人都會(huì)誤解, 從表面上看都是把相關(guān)信息查詢出來(lái),然后添加到一個(gè)表里,其實(shí)還遠(yuǎn)遠(yuǎn)沒有這么簡(jiǎn)單,接下來(lái),小豬就用最普通的表述給大家介紹一下這兩者間的區(qū)別。

步驟/方法

1、首先,我們來(lái)看一下insert into select語(yǔ)句,其語(yǔ)法形式為:Insert into Table2(field1,field2,...) select value1,value2,... from Table1。

select into from與insert into select區(qū)別詳解 

2、這里的要求就是Table2必須已經(jīng)存在,如果不存在,系統(tǒng)則會(huì)提示對(duì)象無(wú)效。

select into from與insert into select區(qū)別詳解 

3、同時(shí)因?yàn)門able2已經(jīng)存在,所以我們就可以任意的向Table2中加入符合列類型的內(nèi)容,當(dāng)然也包括常量,也許通過下面的圖,你就會(huì)發(fā)現(xiàn),在導(dǎo)入常量時(shí)候的不尋?,F(xiàn)象了。

select into from與insert into select區(qū)別詳解 

4、接下來(lái)說一下select into from 語(yǔ)句,該語(yǔ)法形式為:SELECT vale1, value2 into Table2 from Table1。

select into from與insert into select區(qū)別詳解 

5、這里要求的是MyTable1不存在,因?yàn)樵诓迦氲臅r(shí)候,系統(tǒng)會(huì)自動(dòng)創(chuàng)建MyTable1,如果之前MyTable1已經(jīng)被創(chuàng)建,系統(tǒng)就會(huì)提示已經(jīng)存在表。

select into from與insert into select區(qū)別詳解 

6、就是因?yàn)檫@個(gè)特性,就會(huì)給我們帶來(lái)很多的方便,首先,我如果只想要MyTable2表中的ID列的話那我只需要將ID列select出來(lái),然后加入到新表中即可。

select into from與insert into select區(qū)別詳解 

7、那如果我想要MyTable2中的Name列,那我也僅僅是需要把Name列select出來(lái),然后添加到新表中即可。

select into from與insert into select區(qū)別詳解 

END

注意事項(xiàng)

應(yīng)用范圍由實(shí)踐者自己找到答案~

相關(guān)文章

最新評(píng)論