🗒 Cheat Sheet← Lesson
BitWithBite
SQL Worksheet

🗃 Aggregates, GROUP BY & HAVING

Chapter: SQL · Level ★☆☆ · Time: 30 min
SCORE___ / 20
NameClassDate
After this worksheet you can
Use COUNT SUM AVG MIN MAXGroup rows with GROUP BYFilter groups with HAVINGKnow WHERE vs HAVING

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

1Count all rows:
2Average price:
3Group rows by city with:
4Filter groups (not rows) with:

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

5(price) finds the largest price.
6SUM(qty) adds up the column.
7Count students per grade.
8Average order value per customer.
9Cities with more than 100 users.

🚀 Section C · Challenge ● CHALLENGE 5

10Why can't you put COUNT(*) in WHERE?
💭 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-A   2-B   3-A   4-B  |  5 MAX   6 qty   7 = SELECT grade, COUNT(*) FROM students GROUP BY grade;   8 = SELECT customer_id, AVG(total) FROM orders GROUP BY customer_id;   9 = SELECT city, COUNT(*) FROM users GROUP BY city HAVING COUNT(*) > 100;  |  10 = WHERE runs before aggregation - use HAVING for aggregates

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