Semi-joins and anti-joins filter rows rather than merge tables: a semi-join keeps the left rows that have a match, an anti-join keeps the ones that do not, and neither adds a column or multiplies a row. This cheatsheet gathers the whole toolkit on one page, from EXISTS and IN through NOT EXISTS, the NOT IN null trap, and did-X-but-not-Y segments, each snippet annotated line by line. Keep it open while you write SQL, or save the image and pin it nearby.
For the full background, read the guide to semi-joins and anti-joins in BigQuery. To practise, work through the 10 code-along examples.
Download the cheatsheet
Hope this helps.
[…] Semi-Joins and Anti-Joins in BigQuery Cheatsheet […]
[…] Cheatsheet: https://datalad.co.uk/semi-joins-and-anti-joins-in-bigquery-cheatsheet/ […]