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

Explain an extent?

1110


Differentiate between pre-select and pre-query?

1116


Explain the use of constraints option in exp command.

1053


Explain about your project and its relation to the current job position you are applying to?

1017


What are the different types of modules in oracle forms?

1006


What is ordinary table in oracle?

1166


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?

2834


How to use "for" statements in oracle?

1080


Explain how are indexes update?

1072


How to write a query with a left outer join in oracle?

1070


What is logical backup in oracle?

1025


What language does oracle use?

1117


what is meant by magic query

2192


Differentiate between translate and replace?

1126


what is the use of triggers in Java program? I mean where do we use triggers in Java programming?

2190