sql 常用 insert 語句

一、insert into 表(列1,列2...) values (值1,值2...);

二、create table 表1 as select * from 表2 where 1    /*創建表1,當where 1時拷貝所有表結構和數據當where 0時只拷貝表結構不拷貝數據*/

三、insert into 表1 select * from 表2    /*表1如果存在,從表2拷貝數據到表1*/

四、insert into 表1(列1,列2...) select (表2.列1,表2.列2...) from 表2    /*獲取表2中指定列插入到表1中,列名不需要一致,但是數據類型要相同*/


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章