Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@dan81989
Created May 25, 2016 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dan81989/f058077a5cf311370b975320b6feae35 to your computer and use it in GitHub Desktop.
Save dan81989/f058077a5cf311370b975320b6feae35 to your computer and use it in GitHub Desktop.
Why would such a right join be useful? Simply adding a “where first_name is NULL” line to our SQL query returns a list of all orders for which we failed to record information about the customers who placed them:
select first_name, last_name, order_date, order_amount
from customers c
right join orders o
on c.customer_id = o.customer_id
where first_name is NULL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment