Step 1 of 10
SQL JOINs: combine two tables
In this lesson you practise SQL joins on two small tables: customers and the orders they placed. You will see which rows each join keeps, which it leaves out, and why, then write joins of your own and check the answers.
Here is the whole idea in one picture. Each line is a pair of rows that match: an order and the customer it belongs to. Press the join types and watch which rows make it into the result.
In this lesson you'll
- connect two tables through a key:
customers.idandorders.customer_id - write INNER, LEFT, RIGHT, FULL OUTER and CROSS joins and predict their row counts
- find what is missing: customers who never ordered, orders with no customer
- total and count joined rows without the classic mistakes
About 60 minutes, with checks along the way, a practice set and a final quiz.