find out the third highest salary?
Answer Posted / amit singh
forget the book first
Empsal table data
700
500
100
900
400
200
600
750
query to find second highest salary from table Empsal
mysql>select distinct(max(e.salary)) from Empsal e
>where e.salary in(
>select e1.salary from Empsal e1 where e1.salary<(select max(salary) from Empsal));
Output=750
query to find third highest salary from table Empsal
mysql>select distinct(max(e.salary)) from Empsal e
>where e.salary in(
>select e1.salary from Empsal e1 where e1.salary<
>(select max(e1.salary) from Empsal e1
>where e1.salary IN(
>select e2.salary from Empsal e2 where
>e2.salary<(select max(salary) from Empsal))));
Output=700
don't args without run
amitsing2008@gmail.com(amy is back again)
Is This Answer Correct ? | 3 Yes | 5 No |
Post New Answer View All Answers
How to define an oracle sub procedure?
what are archived logs?
Where do we use decode and case statements?
How can I get column names from a table in oracle?
What is coalesce function?
Will you be able to store pictures in the database?
What is a cursor variable?
How to assign data of the deleted row to variables?
What is a database table in oracle?
What is oracle database 10g express edition?
How to write a query with a right outer join in oracle?
How to lock and unlock a user account in oracle?
How do you find current date and time in oracle?
Explain the use of record option in exp command.
What is instant client oracle?