insert into 和select 結合使用

2022-05-10 04:56:00 字數 601 閱讀 9270

1.語法

insert into 新建表名 (新建表的字段)

select 欄位1,欄位2,欄位3 ······

2.例子

insert

into

newtb (district,districtid,town,townid,village,villageid)

select

infotb.district,infotb.districtid,infotb.town,infotb.townid,infotb.village,dictionary.villageid

from

infotb,dictionary

where infotb.village like dictionary.village and infotb.town like dictionary.town and infotb.districtid like dictionary.districtid;

3.select的特殊用法

select 1 from 表名 

查詢結果為表內資料個1

select 後邊還可以直接跟字串或數字,查詢結果的的對應欄位處都是該數字或者字串。

Access提示Insert Into 語法錯誤

1.關鍵字 如果你的資料庫的表的設計包含了access包含的關鍵字,則在插入的時候會出現 insert into 語法錯誤 例如 string sqltext string.format insert into testtable id,order values 123,0 這行上面這條語句是失敗的...

MySQL插入命令 INSERT INTO

mysql允許將乙個或多個元組插入已存在的table中。格式 insert into 表名 屬性名1,屬性名2,屬性名3 values value1,value2,value3 insert into 表名 屬性名1,屬性名2,屬性名3 values value a1,value a2,value ...

socket程式設計使用poll替換select

poll函式在處理併發時,無fd setsize限制 伺服器端 include include include include include include 使用signal函式 include 使用wait函式 include include include include include de...