← All Exercises
Window Function Ranking
intermediatesql
Background
Window functions enable complex analytical queries without self-joins or subqueries.
Problem
Rank employees by salary within each department using window functions.
Input
Employee table with salaries
Output
Ranked results per department
Sample tests
Sample 1
Input: employees with dept and salary
Expected: ranked by salary
Your solution
Learning objective
Learn analytical SQL and window function patterns