1.
数据库表A 有个字段a是int类型
a中有数据有1到9任意(有重复的)
想取得a中,当 a=1时 a=2时 a=3…… 各一条记录的列表
select top 1 * from A where a=1
union
select top 1 * from A where a=2
...
union
select top 1 * from A where a=9
2.
S(SNO,SNAME)学生表
C(CNO,CNAME,CTEARCHER)课程表
SC(SNO,CNO,SCGRADE)成绩表
1.找出没有选修李明老师课程的所有学生姓名
2.找出每门课程成绩在90分以上的学生姓名及成绩
select S.SNAME from STUDENT as S inner join TECHER as T
inner join Souce as So
on T.CNO=So.CNO
on S.SNO=So.SNO
where T.CTEACHER <>'李明'
select s.SNAME
from STUDENT as S inner join TECHER as T
inner join Souce as So
on T.CNO=So.CNO
on S.SNO=So.SNO
where not exists(select 1 from sc where sno=a.sno and cno=a.cno and grade<90)
3.
本题用到下面三个关系表