SQL向表中插入数据的几种方法

sql | 2016-10-26 22:50:09 | 阅读 1547 次 | 评论(0)

[1] ----insert into tablename(表名)(firstcol,secondcol......,lastcol)[列名]values('','','')

【values后面跟的值的类型必须跟表中的列名定义的类型相同】

[2]--------------------------------------
insert into Student(S_StuNo,S_Name,S_Sex,S_Height)
select '001','项羽','','190' union
select '002','刘邦','','170' union
select '003','貂蝉','','180' union
select '004','天明','','155' union
select '005','少司命','','175' ..........
把一个表中的数据插入到另外的表中
select * into [newTableName] from [Table_Name]

向新表Student_back中插入部分数据-------------


 insert into Student_back(S_StuNo,S_Name,S_Sex,S_Height) 
 select S_StuNo,S_Name,S_Sex,S_Height from Student 
 where S_Sex=''









文章评论,共0条
游客请输入验证码
浏览21457次
最新评论