与 UNION SQL 查询相反

Mic*_*tor 0 sql postgresql

我有 2 张桌子:

interests (storing the interest ID and name)
person_interests(storing the person_id and interest_id)
Run Code Online (Sandbox Code Playgroud)

如何选择特定人未选择的所有兴趣?

我已经尝试了以下 SQL 查询,但仍然没有得到想要的结果

SELECT * 
  FROM interests LEFT JOIN person_interests 
               ON interests.id=person_interests.person_id
 WHERE person_interests.id IS NULL 
   AND person_id=66;
Run Code Online (Sandbox Code Playgroud)

小智 5

NOT EXISTS

SELECT *
FROM interests
WHERE NOT EXISTS (
        SELECT person_interests.interest_id
        FROM person_interests
        WHERE person_id = 66
            AND interests.id = person_interests.interest_id
        )
Run Code Online (Sandbox Code Playgroud)