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

前端之家收集整理的这篇文章主要介绍了SQL向表中插入数据的几种方法前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

[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_Height) 
 select S_StuNo,S_Height from Student 
 where S_Sex=''









猜你在找的MsSQL相关文章