Keyword of sql set operation
In sql, the calculation of sets is: union, difference, and intersection.
Union: union, union all
difference: EXISTS, not in, except
intersection: InterSect
But, not every database supports all of the above, and the keywords are not the same. Just like oracle, minus is used for difference. emmm ... so uncomfortable.
join can also be achieved
To achieve this situation, inner join is enough.
To achieve this, left join is enough.
To achieve this, right join is enough.
To achieve this situation:
select *
from a left join b
on a.id = b.id
where b.id is null
To achieve this situation:
select *
from a right join b
on a.id = b.id
where a.id is null
https://blog.csdn.net/weixin_42845682/article/details/105412597 There is a question in this article, you can practice it after reading it.