表结构
查询所有分数为80分以上的人:
SQL语句
SELECT DISTINCT
t1.student_id
FROM
scores t1
WHERE
NOT EXISTS (
SELECT
*
FROM
scores t2
WHERE
t1.student_id = t2.student_id
AND t2.score < 80
);
问题:
为什么not exists
里面的 and t2.score < 80
不能是t1.score < 80
呢?