Part 99: Named Windows with the WINDOW Clause
When multiple window functions share the exact same PARTITION BY and ORDER BY specification, don't repeat yourself—use a named WINDOW clause:
1. Syntax
SELECT
first_name,
salary,
RANK() OVER w,
DENSE_RANK() OVER w,
AVG(salary) OVER w
FROM employees
WINDOW w AS (PARTITION BY department ORDER BY salary DESC);
Key Takeaways
- Keep complex analytical queries clean and DRY using named
WINDOWdefinitions.
In Part 100, we conclude Module 10 with a Month-over-Month Growth & Churn Analysis Project!

