Need a SQL query to find 5th highest salary of employee without using rank or top functions | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Need a SQL query to find 5th highest salary of employee without using rank or top functions

I have a table columns emp I'd,emp salay, Need a SQL to find 5th highest salary of employee without using rank or top functions

6th Aug 2021, 8:58 PM
vijay
vijay - avatar
1 Answer
+ 2
There is a way you can generate rownum (1, 2, 3, ...) on the sorted result set. How you do it depends on which DB engine you are using. Then select from that augmented set (e.g., as a subquery) where rownum=5.
7th Aug 2021, 12:37 AM
Brian
Brian - avatar