小编整理“计算机考研数据库知识点:嵌套查询”相关内容,一起来看。
IN引出的子查询
SELECT Sno,Sname FROM Students WHERE Sex = '女' AND Speciality IN (
SELECT Speciality FROM Students WHERE Sname ='王丽丽'
);
集合的比较引出的子查询
SELECT Sno,Sname,Speciality,Birthday FROM Students WHERE Speciality <> '软件工程' AND Birthday > ALL(
SELECT Birthday FROM Students WHERE Speciality = '软件工程'
);
存在量词引出的子查询
SELECT Sno,Sname FROM Students S WHERE EXISTS (
SELECT * FROM SC WHERE Sno=S.Sno AND Cno = 'CS403');