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 Materialized View? In What Scenario we Use Materialized View?

9401


Explain scalar functions in sql?

1019


What is clause in sql?

1056


how to calculate expressions with sql statements? : Sql dba

985


Show the cursor attributes of pl/sql.

998


Which is faster view or stored procedure?

889


What is the difference between left outer join and left join?

945


Why are indexes and views important to an organization?

899


Why is pl sql needed?

877


What is #table in sql?

997


How do I view tables in mysql?

917


what is an extent ? : Sql dba

1021


Is natural join same as inner join?

872


Is left join faster than inner join?

1065


What is the purpose of my sql?

902