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
What is analyze command used for?
How to revoke create session privilege from a user in oracle?
hey friends, What are the steps I can do to transfer the database from Microsoft Access 2003 to oracle10g (or SQL) Best regards
What is oracle analytical function?
Explain the dml?
How to write a query with an inner join in oracle?
In the oracle version 9.3.0.5.0, what does each number shows?
Name the three major set of files on disk that compose a database in Oracle?
How to apply filtering criteria at group level in oracle?
What are the major difference between truncate and delete?
How to check your oracle database 10g xe installation?
How to get the Installed Oracle Version Information ?
Explain what are the uses of rollback segment?
Can a parameter be passed to a cursor?
Will you be able to store pictures in the database?