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

What the is the diff between local index and global index. give some example.

1589


Why packages are used in oracle?

1001


How to create an oracle database manually?

1023


What are nested tables?

1107


What is an external table?

959


What is data block in Oracle?

1049


I have a table called 'test' on source and target with same name, structure and data type but in a different column order. How can you setup replication for this table?

1047


What view(s) do you use to associate a users SQLPLUS session with his o/s process?

2309


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?

974


What privilege is needed for a user to create indexes in oracle?

965


What is a table index?

1013


various types of hints and their usage

2627


HI Friends Myself Manoj,i am from bengaluru.i have 1 yr of exp in PLSQL but not upto the mark..now attending interviews but m not able to clear even 1 round..i have attended 3 interviews till today.purpose of writing this query is,i want to know the intreview topics that interviewer going to ask frequently,mainly SCENARIO based questions.IF anybody have any PLSQL projects please give it to me,it will helps me alot.Thanks for your patience.

1368


How to compare dates in oracle sql?

1043


What are ddl statements in oracle?

1018