PracHub
QuestionsPremiumLearningGuidesInterview PrepNEWCoaches

Quick Overview

This question evaluates SQL data manipulation competency, focusing on group-wise aggregation, ordering, and selecting the top-N salary values within each department.

  • Medium
  • Amazon
  • Data Manipulation (SQL/Python)
  • Data Scientist

Find Top-3 Salaries Per Department Using SQL

Company: Amazon

Role: Data Scientist

Category: Data Manipulation (SQL/Python)

Difficulty: Medium

Interview Round: Onsite

employees +----+---------+--------+---------+ | id | name | salary | dept_id | +----+---------+--------+---------+ | 1 | Alice | 120000 | 10 | | 2 | Bob | 90000 | 10 | | 3 | Charlie | 115000 | 20 | | 4 | David | 130000 | 10 | | 5 | Eve | 110000 | 20 | +----+---------+--------+---------+ ##### Scenario Employee compensation analysis across departments ##### Question Given an employees table with salary and department columns, write SQL to return the top-3 salary amounts in each department (it’s okay if fewer than three employees tie for a salary amount). ##### Hints Use window functions (ROW_NUMBER/RANK/DENSE_RANK) or MAX subqueries to isolate the three highest salaries per department.

Quick Answer: This question evaluates SQL data manipulation competency, focusing on group-wise aggregation, ordering, and selecting the top-N salary values within each department.

Last updated: Mar 29, 2026

Loading coding console...

PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.

Related Coding Questions

  • Find recommended friend pairs by shared songs - Amazon (medium)
  • Find recommended friend pairs by shared listening - Amazon (easy)
  • Write SQL window functions for D7 retention - Amazon (medium)
  • Find daily first-order merchants with SQL - Amazon (Medium)
  • Design student–course data models and SQL - Amazon (Medium)