以实验三数据为基础,用 T-SQL 语句实现下列数据查询操作。
select snum,sname,ssex,sdept from student
where snum in (select sno from cj
where cno=(select cnum from course
where cname='数据库'))
select sno,cno,score from cj
where sno in (select snum from student
where sage<(select sage from student
where sname='李咏'))
select * from student
where sdept not like '信息系' and sage>(select min(sage) from student
where sdept='信息系')
select sname from student
where sdept not like '商务系' and sage>(select max(sage) from student
where sdept='商务系')
select distinct student.sname from cj,student
where student.snum=cj.sno and cj.cno='c001' and cj.score>70
select sname from student
where snum not in (select sno from cj)
select COUNT(cnum) from course
select student.sname from student,cj
where student.snum=cj.sno
group by student.sname,cj.sno having count(cj.cno)>1
select * from course
where cname like '数据%'
select cnum,cname from course
where exists(select * from cj
where exists(select * from student
where course.cnum=cj.cno and sname like '_向%'))
select student.snum,student.sname,student.sdept from student,cj
where student.snum=cj.sno and cno in (select cnum from course
where cname='数据库' or cname='数学')
select distinct * from student
where snum not in(select distinct sno from cj)
select * from student
where sage<>(select sage from student
where sname like '张力')
select snum,sname,AVG(score)as '平均成绩' from student,cj
where student.snum=cj.sno
group by student.snum,sname having AVG(score)>(select AVG(score) from cj,student
where student.snum=cj.sno and student.sname= '张力')
select snum,sname from student
where snum in(select sno from cj where cno in (select cnum from course where cname='数据结构'))
select sname,sage,sdept from student
where sdept not like '计算机系' and sage<(select MIN(sage) from student)
select * from student
where sdept=(select sdept from student where sname='张力') and sname<>'张力'