查询没有所有课程的同学的信息这种解法不包括什么课都没选的学生select student.* from student, (select sid, count(cid) as coursecount from sc group by sid) as t1where student.sid = t1.sidand t1.coursecount<>3select student.*from sc ,studentwhere sc.SId=student.SIdGROUP BY sc.SIdHaving count(*)<(select count(*) from course)利用笛卡尔积可以把什么课都没选的同学查询出来select DISTINCT student.*from(select student.SId,course.CIdfrom student,course ) as t1 LEFT JOIN (SELECT sc.SId,sc.CId from sc)as t2 on t1.SId=t2.SId and t1.CId=t2.CId,studentwhere t2.SId is nulland t1.SId=student.SIdselect student.* from studentwhere student.sid not in (select student.sid from sc, studentwhere sc.sid = student.sidgroup by sidhaving count(*) = (select count(*) from course))