- 0
- 0
- 约小于1千字
- 约 5页
- 2018-03-29 发布于河南
- 举报
sql2008试验4
试验4
--数据更新及视图--
use student
go
--1.删除学生L.M.WANG的记录;--
delete S where S.sn=L.M.WANG;
select *from S;
--2.删除计算机系的全体学生选课记录—
if OBJECT_ID(SC)IS NOT NULL
delete SC where SC.sno in(select sno from S where S.sd=CS)
go
--3.插入一个选课记录:(,C134,)--
insert into SC values(010903,C134,4);
select *from SC
go
--4.将数学系的学生的年龄均加;--
update S set sa=sa+1 where sd=MA;
go--5.将数学系的年龄置为--
update S set sa=20 where sd=MA;
go
--6.定义一个计算机系学生的姓名,修读课程,及成绩的视图S_SC_C
create view S_SC_C
as
select sn,cn,g
from S inner join (SC inner join C on SC.cno=C.cno) on S.sno=SC.sno
where sd=CS
select *
from S_SC_C
go 说明:前面(2)删掉了计算机系学生的选
原创力文档

文档评论(0)