Back to Browse

RealTech Query DAY 1 - 2nd & 3rd Highest Salary | Multiple Methods Explained" #viral #SQL#Coding

92 views
Apr 22, 2026
3:58

This video from Real Tech Inside Out provides a practical tutorial on how to retrieve the second and third highest salaries from an employee database table using SQL. The creator demonstrates two common methods to solve this frequently asked interview question: Method 1: Subquery Approach (0:47 - 2:00) This method uses the `MAX()` function within a `WHERE` clause to filter out the highest salaries. To find the second highest, you exclude the maximum salary using `WHERE (0:51 - 1:13). To find the third highest, you extend the subquery logic to exclude the top two salaries 1:27 - 1:58. Method 2: ORDER BY and LIMIT/OFFSET Approach (2:04 - 3:33) This method sorts the data in descending order using `ORDER BY salary DESC` (2:25 - 2:32). By using the `LIMIT` and `OFFSET` clauses, you can pinpoint specific ranks. For example, to get the third highest, you use `OFFSET 2` (3:02 - 3:07), and for the second highest, you use `OFFSET 1` (3:18 - 3:30).

Download

0 formats

No download links available.

RealTech Query DAY 1 - 2nd & 3rd Highest Salary | Multiple Methods Explained" #viral #SQL#Coding | NatokHD