SLSkillLoop
SQL practice

SQL JOINs Practice

JOINs help you combine related data across tables. These beginner exercises focus on reading relationships and writing clear INNER JOIN and LEFT JOIN queries.

How to practice SQL JOINs

JOIN practice teaches you to read relationships between tables. The key question is not only which tables are involved, but how rows from those tables match each other.

Start by finding the primary key and foreign key in the prompt. Then decide whether the query should keep only matching rows or keep all rows from one side with a LEFT JOIN.

What to focus on
  • Primary keys and foreign keys
  • INNER JOIN and LEFT JOIN behavior
  • Selecting clear columns from multiple tables

Example practice questions

Try these samples, then continue into the SQL Practice Labfor guided browser-based practice.

1

Join orders to users using orders.user_id and users.id.

Answer: SELECT * FROM orders JOIN users ON orders.user_id = users.id;

2

Return each order id with the user's email.

Answer: SELECT orders.id, users.email FROM orders JOIN users ON orders.user_id = users.id;

3

Join products to categories using products.category_id and categories.id.

Answer: SELECT * FROM products JOIN categories ON products.category_id = categories.id;

4

Return all users, even users with no orders.

Answer: SELECT * FROM users LEFT JOIN orders ON users.id = orders.user_id;

5

Return product names and category names.

Answer: SELECT products.name, categories.name FROM products JOIN categories ON products.category_id = categories.id;

6

Join order_items to products using product_id.

Answer: SELECT * FROM order_items JOIN products ON order_items.product_id = products.id;

7

Return orders with user email where status is 'paid'.

Answer: SELECT orders.*, users.email FROM orders JOIN users ON orders.user_id = users.id WHERE orders.status = 'paid';