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
Explain an extent?
Differentiate between pre-select and pre-query?
Explain the use of constraints option in exp command.
Explain about your project and its relation to the current job position you are applying to?
What are the different types of modules in oracle forms?
What is ordinary table in oracle?
How can you tell how much space is left on a given file system and how much space each of the file systems subdirectories take-up?
How to use "for" statements in oracle?
Explain how are indexes update?
How to write a query with a left outer join in oracle?
What is logical backup in oracle?
What language does oracle use?
what is meant by magic query
Differentiate between translate and replace?
what is the use of triggers in Java program? I mean where do we use triggers in Java programming?