Week 13 • Thursday

Block 128: SQL Aggregations & Window Functions

Write advanced SQL queries for analytics.

Concepts

Code Examples

See exercise below.

Exercise

Write a query using GROUP BY + HAVING to find courses with more than 2 enrolled students. Use a window function to rank students by grade within each course.

Homework

Explain the difference between WHERE and HAVING. When can each be used? Friday