Home » SQL & PL/SQL » SQL & PL/SQL » select query
select query [message #18633] Thu, 07 February 2002 20:14 Go to next message
krishna
Messages: 141
Registered: October 1998
Senior Member
How do i write a sql select statement for selecting the name of the person getting the fifth highest salary from the emp table? What is the syntax?
Re: select query [message #18637 is a reply to message #18633] Fri, 08 February 2002 01:04 Go to previous message
pratap kumar tripathy
Messages: 660
Registered: January 2002
Senior Member
try one of these

select * from emp e1
where 4=(select count(*) from emp e2 where e2.sal>e1.sal)

select e1.empno
from emp e1,emp e2
where e2.sal>e1.sal
group by e1.empno
having count(*) =4
Previous Topic: Decode statement
Next Topic: PL/SQL TEMP TABLES.,CAN YOU CHECK IF A VALUES EXISTS
Goto Forum:
  


Current Time: Wed Apr 24 22:35:41 CDT 2024