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 get second highest sal of emp table

Answer Posted / prabhudatta barick

--IN ORDER TO FIND THE NTH HIGHEST SALARY,
--WE JUST FIND THE SALARY THAT HAS EXACTLY N-1 SALARIES
GREATER THAN ITSELF---

--This is correlated subquery--
select empno,
ename,
sal
from scott.emp e
where &n-1=(select count(distinct b.sal) from scott.emp b
where b.sal>e.sal);

To get second highest salary put n value 2.

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to check the server version in oracle?

1143


What is data file?

1152


Which is better Oracle or MS SQL? Why?

6486


Why is oracle database so popular?

1074


What are the major difference between truncate and delete?

1136


What are the various constraints used in oracle?

1097


Explain what are the different type of segments?

1003


Is postgres faster than oracle?

1087


How to do paging with oracle?

1053


How can we find out the current date and time in oracle?

1132


What is recovery manager(rman) backup in Oracle?

1231


How to open a cursor variable?

1089


What do you mean by a tablespace?

1092


What is max rowid in oracle?

1084


Is oracle a programming language?

1039