Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Find nth Salary Without Using Max or Top In SQL
WhatsApp
Pankaj Pandey
5y
117.9
k
0
6
25
Blog
Here I am writing SQL query to find nth salary without using top or max keywords.
SELECT
*
FROM
(
SELECT
ROW_NUMBER() OVER (
ORDER
BY
SALARY
DESC
)
AS
rownumber,Salary
FROM
Employee )
AS
foo
WHERE
rownumber = n
Example:
SELECT
*
FROM
(
SELECT
ROW_NUMBER() OVER (
ORDER
BY
SALARY
DESC
)
AS
rownumber,Salary
FROM
Employee )
AS
foo
WHERE
rownumber = 5
The above query will show 5th highest salary from Employee table.
Here is a free eBook,
SQL Queries for Beginners
Find nth salary without using max or top keyword
People also reading
Membership not found