SQL Exercises

Intermediate SQL INNER JOIN Exercises

0 Exercises
~0 min

Intermediate-level SQL INNER JOIN practice exercises with solutions.

Exercise 1

Question: Join employees with their departments to show employee name and department name.

SELECT e.name AS employee_name, d.name AS department_name FROM employees e INNER JOIN departments d ON e.department_id = d.id;

INNER JOIN returns only rows that have matching values in both tables. Use table aliases (e, d) for cleaner code.

Exercise 2

Question: Find all orders with their customer names and product names.

SELECT c.name AS customer, p.name AS product, o.quantity FROM orders o INNER JOIN customers c ON o.customer_id = c.id INNER JOIN products p ON o.product_id = p.id;

You can chain multiple JOINs to connect several tables. Each JOIN adds one more table to the result.

Related Content

From Our Blog

Ready for more practice?

Join SQL Mastery and get access to interactive exercises, quizzes, and more.