Explore Library
QuizAdvanced

Filtering on Window Function Results

Learn why filtering a window function result requires a subquery or CTE, not a WHERE clause.

You want to return only the rows where ROW_NUMBER() OVER (PARTITION BY dept ORDER BY salary DESC) equals 1. Why must you wrap the query in a subquery or CTE instead of using WHERE row_num = 1?