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
Why do we use coalesce function in oracle?
What is using clause and give example?
Explain oracle 12c new features for developers?
What is a trigger oracle?
What is a procedure in oracle?
What is a sub query? What are its various types?
Explain an extent?
Write a trigger example in oracle?
How to delete a column in an existing table?
When do you get a .pll extension in oracle? Explain its importance
How to shutdown your 10g xe server from command line?
What is meant by raw datatype?
What is the difference between I and G in Oracle?
what are steps for interface? where is exchange rate defined in which table?
What is an Oracle Instance?