Explore Library
Quiz

Filtering on Window Function Results

Learn why you cannot filter a window function in WHERE and must use a CTE or subquery instead.

You want each employee's row where their salary rank within their department (ROW_NUMBER() OVER (PARTITION BY dept ORDER BY salary DESC)) equals 1. Which approach works correctly?