33、 查詢成績比該課程平均成績低的同學的成績表。
select * from score a where a.degree between 0 and(
select avg(degree) from score b where a.cno=b.cno )
34、 查詢所有任課教師的Tname和Depart.
select tname,depart from teacher where tno in(
select tno from course )
35 、 查詢所有未講課的教師的Tname和Depart.
select tname,depart from teacher where tno not in(
select tno from course )
36、查詢至少有2名男生的班號。
select sclass from student where ssex = '男' group by sclass having count(sno)>=2
37、查詢Student表中不姓“王”的同學記錄。
select * from student where sname not like '王%'
38、查詢Student表中每個學生的姓名和年齡。
39、查詢Student表中最大和最小的Sbirthday日期值。
select max(t.sbirthday),min(t.sbirthday) from student t
40、以班號和年齡從大到小的順序查詢Student表中的全部記錄。
select * from student order by sclass desc , sbirthday asc
41、查詢“男”教師及其所上的課程。
select tname , cname from teacher t ,course c where tsex = '男'and t.tno=c.tno
42、查詢最高分同學的Sno、Cno和Degree列。
select * from score where degree =(
select max(degree) from score)
43、查詢和“李軍”同性別的所有同學的Sname.
select sname from student where ssex = (
select ssex from student where sname ='李軍')
44、查詢和“李軍”同性別並同班的同學Sname.
select sname from student where ssex = (
select ssex from student where sname ='李軍')
and sclass =(
select sclass from student where sname ='李軍')
45、查詢所有選修“計算機導論”課程的“男”同學的成績表。
select * from score where sno in (
select sno from student where ssex = '男')
and cno in (
select cno from course where cname = '計算機導論')