🗒 Cheat Sheet← Lesson
BitWithBite
SQL Worksheet

🗃 Window Functions

Chapter: SQL · Level ★☆☆ · Time: 30 min
SCORE___ / 20
NameClassDate
After this worksheet you can
Use OVER with PARTITION BYRank rows with ROW_NUMBER/RANKRunning totalsWindow vs GROUP BY

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

1Window functions use the keyword:
2RANK() gives ties:
3PARTITION BY is like:
4Running total uses:

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

5ROW_NUMBER() OVER (ORDER BY score DESC) numbers rows from .
6PARTITION BY city restarts the window per .
7Rank students by score within each class.
8Running revenue by date.
9Top-1 per group - which pattern?

🚀 Section C · Challenge ● CHALLENGE 5

10Window vs GROUP BY in one line?
💭 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-A   3-A   4-A  |  5 1   6 city   7 = RANK() OVER (PARTITION BY class ORDER BY score DESC)   8 = SUM(amount) OVER (ORDER BY order_date)   9 = ROW_NUMBER() ... then WHERE rn = 1  |  10 = GROUP BY collapses rows; window adds a computed column keeping rows

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