Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What do you mean by merge in oracle and how can you merge two tables?

948


How would you go about verifying the network name that the local_listener is currently using?

2046


What is a user role in oracle?

1121


How to store pictures on to the database?

973


What is the difference between I and G in Oracle?

1097


What is a data lock in oracle?

1115


How to use subqueries with the exists operator in oracle?

1027


What is meant by joins?

1058


What are oracle functions?

1030


What are the common oracle dba tasks?

1145


Use of an integrity constraint is better to validate data. Explain

1040


Calculate difference between 2 date / times in oracle sql?

1040


What is difference between sid and service name in oracle?

954


Please explain oracle left join with an example?

1043


What is a subquery in oracle?

1109