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 is server name sql?

1141


define sql update statement ? : Sql dba

1114


How does cross join work in sql?

1014


Can we create a trigger on view?

893


what is top in tsql? : Transact sql

1113


Mention what does plv msg allows you to do?

1107


What is sqlcontext?

1079


Explain the structure of pl/sql in brief.

1093


How many subqueries can be nested in a statement?

982


How to run sql commands in sql*plus?

1175


What are the sql commands?

1171


If the application is running very slow? At what points you need to go about the database in order to improve the performance?

997


What is a join query?

956


What is trigger in sql? Explain

994


How can use stored procedures in sql?

1134