Back to Browse

SQL Interview Question | Use Different Methods to Find the Nth Highest Salary

22.4K views
Nov 24, 2024
13:46

In this video, I have discussed how to solve the most commonly asked SQL Interview Question : 1. How to find the highest salary? 2. How to find 2nd highest salary? 2. How to find nth highest salary using a Sub-Query? 3. How to find nth highest salary in using a CTE? 4. How to find the 2nd, 3rd or 15th highest salary? -- Create Employees Table Create table Employees ( ID int primary key, FirstName varchar (50), LastName varchar (50), Gender varchar (50) , Salary int ); -- Inser values into employees table insert into Employees values(1, 'Tony', 'Stark', 'Male', 80000), (2, 'Steve', 'Rogers', 'Male', 70000) , (3, 'Thor', 'Odinson', 'Male', 65000), (4, 'Nick', 'Fury', 'Male', 75000), (5, 'Bruce', 'Banner', 'Male', 50000), (6, 'Natasha', 'Ramanoff', 'Female', 65000), (7, 'Jane', 'Foster', 'Female', 45000), (8, 'Peter', 'Parker', 'Male', 80000); SQL Interview QnAs: https://www.youtube.com/playlist?list=PLL871c9yfLoimvglCSz6UQoqLJcFBJGKo #sql #postgresql #deloitte #deloittejobs #mysql #interview #dataengineering #dataanalytics #dataanalysis #capgemini #deloitte #deloittejobs #capgeminihiring

Download

0 formats

No download links available.

SQL Interview Question | Use Different Methods to Find the Nth Highest Salary | NatokHD