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 mutating trigger?

1073


Why is %isopen always false for an implicit cursor?

1153


what is self-join? : Sql dba

1244


How do we accept inputs from user during runtime?

1118


difference between anonymous blocks and sub-programs.

1188


What is view explain with example?

1001


Can we connect to postgresql using sql developer?

1048


how to run 'mysql' commands from a batch file? : Sql dba

1171


Why having clause is used in sql?

1021


Which command is used to call a stored procedure?

1055


Whis is not false in primary key?

1526


How do you explain an index number?

1188


How do I create a sql script?

1143


What is a left join?

1009


Write the alter statement to enable all the triggers on the t.students table.

1176