就是在这么一个数据库中,查询所有没选修“0401010103”课程的学生学号及姓名
“0401010103”是course_id
不太对吧,如果有人选了包括那门课内的多门课,还是会被显示出来
追答先找出选了这门课程的stud_id
从table里除去这些stud,剩下的就是没选修这门课程的
select distinct stud_id,name
from table
where stud_id not in(
select stud_id
from table
where course_id='0401010103'
)
本回答被提问者采纳