0% found this document useful (0 votes)
35 views

SQL

This query finds the second highest salary from a table of employee salaries. It uses a subquery to select the top 2 highest salaries ordered descending by salary. Then it finds the minimum salary from the outer query, which will be the second highest since the highest is excluded.

Uploaded by

Saurabh Kothari
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

SQL

This query finds the second highest salary from a table of employee salaries. It uses a subquery to select the top 2 highest salaries ordered descending by salary. Then it finds the minimum salary from the outer query, which will be the second highest since the highest is excluded.

Uploaded by

Saurabh Kothari
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

to find the second maximum salary?

select min(salary) from tblempsal where salary in(select


distinct
top 2 salary from
tblempsal order by salary desc)

You might also like