08信息综合实训SQL模块上机实训试题1-6题,每小题10分,7-8题每小题20分:有一个[学生课程]数据库,数据

2020-12-05 02:30发布

1条回答
1楼 · 2020-12-05 02:51.采纳回答
--1
create table Student(
Sno int Not NULL PRIMARY KEY Identity (1,1),
Sname varchar(50),
Ssex varchar(2),
Sage int,
Sdept varchar(100)
)

--2
select Sno from SG where Grade<'60'

--3
update Student set Sage='22' where Sno='05001'

--4
select Avg(Grade) from SG where Cno='1'

--5
create proc getDetailByName
@P_Sname varchar(50)
as
if(select count(*) from Student where Sname = @P_Sname) > 0
select * from Student where Sname = @P_Sname
else
print '不存在此学生'

--6
select Sname,Ssex,Sage from Student where Sdept = '计算机' and Sname like '赵%' and Ssex = '男'

--7
create view [学生成绩表视图] as
select Sno,Sname,Cno,Cname,Grade from SG,Student where SG.Sno=Student.Sno

--8
insert into Student values ('05020','丁莉','女','17','计算机')
查看更多

一周热门 更多>