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 is an oracle function?

1169


State and explain the different types of data models?

944


Explain the use of analyse option in exp command.

1129


Can you have more than one content canvas view attached with a window ?

2333


What is a connect identifier?

1042


How to convert dates to characters in oracle?

1042


What is an oracle recycle bin?

1010


What are triggers in oracle?

1040


What are the set operators union, union all, minus & intersect meant to do?

989


Differentiate between pre-select and pre-query?

1113


How to generate query output in html format?

1122


How to login to the server without an instance?

1164


Explain constraining triggers.

1101


Why do we use bulk collect in oracle?

1059


What is the difference between sharding and replication?

1056