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 get the Installed Oracle Version Information ?

1109


What is a dynamic performance view in oracle?

977


Difference between cartesian join and cross join?

1010


Explain what are the characteristics of data files?

1064


Can multiple columns be used in group by in oracle?

960


What is the usage of save points in oracle database?

948


How to delete a column in an existing table?

1059


What is the effect of setting the value "all_rows" for optimizer_goal parameter of the alter session command? What are the factors that affect optimizer in choosing an optimization approach?

1030


What happens internally when the user types userID/password@string in SQL PLUS Thanks-Bhaskar

4542


What are the differences between blob and clob in oracle?

1066


What is Redo Log Buffer in Oracle?

1184


How to create tables for odbc connection testing?

1086


What is the difference between "as" and "is" in an oracle stored procedure?

977


How would you change old and new values in an insert, delete and update triggers?

997


How to install oracle database 10g xe?

996