Amazon SQL Interview Question Using Analytical Functions | Bonus for Top 10% Salaries
In this video, we solve a real Amazon-style SQL interview question using analytical (window) functions. π Problem Statement You are given an employees table with department and salary details. π Your task is to: Give a bonus to the top 10% highest-paid employees in each department If a department has fewer than 10 employees, only the highest-paid employee gets the bonus This question is frequently asked in Amazon Data Analyst, Business Analyst, and Data Engineer interviews, where interviewers test your ability to apply business logic using SQL window functions. π Concepts covered: SQL Analytical / Window Functions DENSE_RANK() COUNT() OVER(PARTITION BY) Conditional logic using CASE WHEN Real-world FAANG-level SQL problem solving SQL Server compatible solution π― Ideal for: Amazon SQL interview preparation FAANG data roles Advanced SQL learners Product & business analytics interviews . . . . #AmazonInterview #SQLInterview #WindowFunctions #AnalyticalFunctions #AmazonSQL #FAANGSQL #AdvancedSQL #DataAnalytics #ProductAnalytics #SQLServer ********************************************************************* CREATE TABLE employees ( employee_id INT, name VARCHAR(50), department VARCHAR(50), salary INT, hire_date DATE ); INSERT INTO employees VALUES -- IT Department (12 employees β top 10%) (1,'Amit','IT',120000,'2021-01-10'), (2,'Rohit','IT',115000,'2021-02-15'), (3,'Neha','IT',110000,'2021-03-20'), (4,'Priya','IT',105000,'2021-04-10'), (5,'Ankit','IT',100000,'2021-05-05'), (6,'Vikas','IT',95000,'2021-06-01'), (7,'Karan','IT',90000,'2021-06-15'), (8,'Sneha','IT',85000,'2021-07-01'), (9,'Pooja','IT',80000,'2021-07-20'), (10,'Ravi','IT',75000,'2021-08-10'), (11,'Deepak','IT',70000,'2021-09-01'), (12,'Nitin','IT',65000,'2021-09-15'), -- HR Department (5 employees β only top 1) (13,'Kavya','HR',90000,'2022-01-10'), (14,'Arjun','HR',85000,'2022-02-15'), (15,'Meena','HR',80000,'2022-03-10'), (16,'Suresh','HR',75000,'2022-04-01'), (17,'Rina','HR',70000,'2022-04-15');
Download
0 formatsNo download links available.