🗒 Cheat Sheet← Lesson
BitWithBite
SQL Worksheet

🗃 Subqueries

Chapter: SQL · Level ★☆☆ · Time: 30 min
SCORE___ / 20
NameClassDate
After this worksheet you can
Nest a query inside anotherUse subqueries with INCompare against aggregatesKnow when a JOIN is better
📚 Quick Recap

A subquery is a SELECT statement nested inside another SQL statement. They can appear in the WHERE clause, FROM clause, or even the SELECT list — letting you answer complex questions in a single query without temporary tables.

🧠 Section A · Concept Check ● BEGINNER 4 × 1 = 4

1A query inside a query is a:
2price > (SELECT AVG(price)...) compares to:
3id IN (SELECT user_id FROM orders) finds users:
4Subqueries go inside:

🧮 Section B · Problem Solving ● INTERMEDIATE 2 + 3×3 = 11

5Subqueries are wrapped in .
6WHERE id (SELECT ...) tests list membership.
7Products more expensive than average.
8Students in the class with the top average.
9Users who placed at least one order (subquery).

🚀 Section C · Challenge ● CHALLENGE 5

10When prefer a JOIN over a subquery?
💭 Reflection — the most useful thing I learned:
A ___/4   B ___/11   C ___/5   Total ___/20 Teacher's Signature Parent's Signature
✂ answer key — fold or cut before handing out

1-B   2-B   3-B   4-A  |  5 parentheses ()   6 IN   7 = SELECT * FROM products WHERE price > (SELECT AVG(price) FROM products);   8 = WHERE class_id = (SELECT class_id ... ORDER BY AVG DESC LIMIT 1)   9 = WHERE id IN (SELECT user_id FROM orders)  |  10 = When you need columns from both tables or better performance

📄 Need offline practice?Download the print-ready PDF or open the one-page cheat sheet.
⬇ Worksheet PDF 🗒 Cheat Sheet