Skip to content

Instantly share code, notes, and snippets.

@dan81989
Created May 25, 2016 18:23
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/cf6bde6540bb49780d75ba20f837e13d to your computer and use it in GitHub Desktop.
Save dan81989/cf6bde6540bb49780d75ba20f837e13d to your computer and use it in GitHub Desktop.
If we wanted to simply append information about orders to our customers table, regardless of whether a customer placed an order or not, we would use a left join. A left join returns all records from table A and any matching records in table B.
select first_name, last_name, order_date, order_amount
from customers c
left join orders o
on c.customer_id = o.customer_id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment