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...

how to find the second highest salary from emp table?

Answer Posted / hitesh pundir

elect max(salary) from m1 where salary not in (select top
n-1 salary from m1 order by salary desc)

-->note where n=number as we want
to display the highest salary.

ex for 2nd highest salary-->
select max(salary) from m1 where salary not in (select top 1
salary from m1 order by salary desc)

ex for 3rd highest salary-->
select max(salary) from m1 where salary not in (select top 2
salary from m1 order by salary desc)

Is This Answer Correct ?    4 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is sql engine in oracle?

987


What are the key differences between SQL and PL SQL?

1211


What is %type in pl sql?

962


Which are sql * plus commands?

1122


what is data manipulation language? : Sql dba

1012


Are sql database names case sensitive?

1000


How do we accept inputs from user during runtime?

1059


what is the difference between truncate and delete statement? : Transact sql

1060


Does mysql support pl sql?

1166


What does desc stand for?

1065


what are the difference between clustered and a non-clustered index? : Sql dba

1030


What are the different parts of a package?

1113


What are the triggers associated with image items?

1041


How many tables can a sql database have?

972


Explain what is a column in a table?

1105