找出至少选修了2号学生选修过的全部课程的学生号
提示:不存在这样的课程y,学生2选修了y,而学生x没有选。
SELECT DISTINCT Sno
FROM SC as SCX
WHERE NOT EXISTS
(SELECT *
FROM SC as SCY
WHERE SCY.Sno =‘2’AND NOT EXISTS
(SELECT *
FROM SC SCZ
WHERE SCZ.Sno=SCX.Sno AND SCZ.Cno=SCY.Cno))
找出至少选修了2号学生选修过的全部课程的学生号
提示:不存在这样的课程y,学生2选修了y,而学生x没有选。
SELECT DISTINCT Sno
FROM SC as SCX
WHERE NOT EXISTS
(SELECT *
FROM SC as SCY
WHERE SCY.Sno =‘2’AND NOT EXISTS
(SELECT *
FROM SC SCZ
WHERE SCZ.Sno=SCX.Sno AND SCZ.Cno=SCY.Cno))