Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Finding nth highest salary from a table
WhatsApp
Nitin
9y
4.6
k
0
1
25
Blog
I have a table. Let us have a look at the contents of it.
We will find out the second highest salary from this table. Write the following query in the query analyser.
select
min
(salary)
from
EmpSalary
where
Salary
in
(
select
top
2 Salary
from
EmpSalary
order
by
salary
desc
)
Execute the preceding script.
For finding out the 3rd highest salary just replace 2 by 3 in the sql command.
select
min
(salary)
from
EmpSalary
where
Salary
in
(
select
top
3 Salary
from
EmpSalary
order
by
salary
desc
)
Finding nth highest salary from a table
Up Next
Select Top 3 and nth highest department wise salary from employee master using partition By clause
Ebook Download
View all
SQL Queries For Beginners
Read by 18.3k people
Download Now!
Learn
View all
Membership not found