how to check the 3rd max salary from an employee table?

Answer Posted / a.brahmam

select * from(select rownum r,sal from(select * from table name order by sal desc))
where r=3;
(or)
select * from(select rownum,sal from table name order by sal desc)
where rownum<=3
minus
select * from(select rownum,sal from table name order by sal desc)
where rownum<=2
(or)
select * from(select sal,dense_rank()over(order by sal desc)r from table name)
where r=3

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are sql built in functions?

677


What are all ddl commands?

741


Is delete faster than truncate?

749


What is consistency?

886


what is meant by nl2br()? : Sql dba

763






How many scalar data types are supported in pl/sql?

714


Is a table valued function object?

759


how can we optimize or increase the speed of a mysql select query? : Sql dba

689


What do you understand by case manipulation functions?

732


what is the command used to fetch first 5 characters of the string? : Sql dba

1365


What is meant by truncate in sql?

752


what are the differences among rownum, rank and dense_rank? : Sql dba

742


What are the 3 modes of parameter?

864


What are sql objects?

738


What is sql entity?

742