Query to find 3rd minimum salary in SQL


Select first_name,last_name,salary from employees order by salary asc;

Query to find 3rd minimum salary

SELECT first_name,last_name,salary from employees e1 
where 3 =(Select COUNT(DISTINCT salary) from employees e2 where e1.salary >e2.salary);

Output:

Leave a Reply

Your email address will not be published. Required fields are marked *