All tasks

Rank Employees by Salary and Aggregate Sales

Expert

Using a CTE, rank employees by salary within their department (highest first). Then, join with sales data to aggregate total sales per employee. Finally, use window functions to identify the top-ranked employee per department along with their aggregated sales. Include employees with no sales (show 0).

Category
Window Functions
Estimated time
~20 min
Databases
PostgreSQLGreenplumMS SQL Server
Tags
window-functionsctejoinrankingada-challengeai-generatedada-challengeexpert

Sign in to solve

Start Solving