sql exists使用

有个场景
sql exists使用
需要找出具体有两门特定课程的同学
这里需要用exists来判断

--找出既是boss 又是basketball
select t.name
from t_student t
where exists (SELECT name FROM t_student where course_name='basketball' and t.name =name)
and exists (SELECT name FROM t_student where course_name='boss' and t.name =name)


你可能感兴趣的:(exists)