🗄️

SQL Intermediate

JOINs, aggregates with GROUP BY, and subqueries.

3 lessons 5 tasks
Lessons Quiz Certificate

📚 Lessons

1 JOINs

A JOIN combines rows from two tables on a related key. INNER JOIN keeps matches; LEFT JOIN keeps all left rows. Always specify the ON condition.

SELECT o.id, u.name, o.total
FROM orders o
INNER JOIN users u ON u.id = o.user_id;

2 Aggregates & GROUP BY

Aggregate functions (COUNT, SUM, AVG, MIN, MAX) summarise groups defined by GROUP BY. Filter groups with HAVING.

SELECT user_id, COUNT(*) AS orders, SUM(total) AS revenue
FROM orders
GROUP BY user_id
HAVING SUM(total) > 100;

3 Subqueries

A subquery is a query nested inside another — useful for filters that depend on an aggregate.

SELECT name, total
FROM orders
WHERE total > (SELECT AVG(total) FROM orders);

📝 Tasks

5 tasks across 2 pages — multiple-choice and fill-in (type the answer). Score 70% or higher to earn your certificate.

🎓 Certificate of Completion

🔒 Pass the quiz above (70%+) to unlock your downloadable certificate.