SQL Server向表中插入数据
一、语句Example 1:
--向学生表中插入数据
INSERT INTO STUDENT VALUES(201215121,'李勇','男',20,'CS');
INSERT INTO STUDENT VALUES(201215122,'刘晨','女',19,'CS');
INSERT INTO STUDENT VALUES(201215123,'王敏','女',18,'MA');
INSERT INTO STUDENT VALUES(201215125,'张立','男',19,'IS'); Example 2:
--向COURSE表中插入数据
INSERT INTO COURSE VALUES(2,'数学',null,2);
INSERT INTO COURSE VALUES(6,'数据处理',null,2);
INSERT INTO COURSE VALUES(7,'PASCAL语言',6,4);
INSERT INTO COURSE VALUES(4,'操作系统',6,3);
INSERT INTO COURSE VALUES(5,'数据结构',7,4);
INSERT INTO COURSE VALUES(1,'数据库',5,4);
INSERT INTO COURSE VALUES(3,'信息系统',1,4); Example 3:
--建立选课表,取名SC
--向SC表中插入数据
INSERT INTO SC VALUES(201215121,1,92);
INSERT INTO SC VALUES(201215121,2,85);
INSERT INTO SC VALUES(201215121,3,88);
INSERT INTO SC VALUES(201215122,2,90);
INSERT INTO SC VALUES(201215122,3,80);
INSERT INTO SC VALUES(201215122,1,59); 二、执行结果
Example 1:
https://img-blog.csdnimg.cn/20210626180104229.png#pic_center
Example 2:
https://img-blog.csdnimg.cn/20210626180118929.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dlaXhpbl80NDQxMDcwNA==,size_16,color_FFFFFF,t_70#pic_center
Example 3:
https://img-blog.csdnimg.cn/20210626180134560.png#pic_center
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
页:
[1]