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

what does the t-sql command ident_incr does? : Transact sql

1126


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

1236


What is set transaction?

1090


How do I restart sql?

1027


Can dml statements be used in pl/sql?

1125


What are the set operators in sql?

1138


Is left join inner or outer by default?

1074


What are aggregate and scalar functions?

1090


How does an execution block start and end in pl sql?

999


What are local and global variables and their differences?

1143


Is left join faster than inner join?

1171


How many types of privileges are available in sql?

1404


explain about mysql and its features. : Sql dba

1054


Can we use the cursor's to create the collection in PL/SQL?

1096


How to use transactions efficiently : transact sql

1116