⌘K
Flycodx

Department Top 3 Salaries

Department Top 3 Salaries

HardSQL0% accepted

Given Employee and Department tables, find employees who have one of the top 3 unique salaries in their department. Use window functions for efficient solution.

Approach

Find top 3 salary earners per department using window functions.

Input

IT dept: salaries 300,300,200,100; Finance: 900,800,700,600

Output

IT: Max(300),Janet(300),Randy(200); Finance: top 3 by unique salary

Scenarios & Expected Answers

Sign in to continue

Create a free account to view answers and mark progress.

  • Free forever — no credit card
  • Theory Q&A with detailed answers
  • Points, streaks & leaderboards
Auto Save On