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 Reduced List of Values?
Differentiate between translate and replace?
What is a select query statement in oracle?
I have a table called 'test' on source and target with same name, structure and data type but in a different column order. How can you setup replication for this table?
What is a table index?
How to pass parameters to procedures in oracle?
What is a tns service name?
Provide an example of a shell script which logs into SQLPLUS as SYS, determines the current date, changes the date format to include minutes & seconds, issues a drop table command, displays the date again, and finally exits.
can u plz provide me oca sql dumps please i need them
please explain.. DB architecture ...
How will you write a query to get a 5th rank student from a table student_report?
What is the max number of columns in an oracle table?
What is a procedure in oracle?
What is a schema in oracle?
How can we create the complete backup of data in the oracle.