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 / sujith

Here is the query to find not only 2nd highest salary, but
nth highest salary also by changing n value......

select e.* from (select * from emp order by sal desc) e
where rownum<=n
minus
select e.* from (select * from emp order by sal desc) e
where rownum<n

This will the record of the person who draws nth highest
salary.........

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do sql triggers work?

1047


What is a dynamic query?

1027


define sql update statement ? : Sql dba

1124


How many types of literals are available in pl sql?

1119


Why do we use function in pl sql?

1065


Do foreign keys improve performance?

1027


what is a database? : Sql dba

1175


What is memory optimized table?

1049


What is number function in sql?

980


How does one use sql*loader to load images, sound clips and documents? : aql loader

1187


how to implement one-to-one, one-to-many and many-to-many relationships while designing tables? : Sql dba

1008


how many triggers are allowed in mysql table? : Sql dba

1071


What are the types of views in sql?

1103


what are the 'mysql' command line options? : Sql dba

1076


What is on delete set null?

1092