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 can find the second max sal for every group(i.e i want
group the data based on key and find the second max sal for
every group

Answers were Sorted based on User's Feedback



how can find the second max sal for every group(i.e i want group the data based on key and find th..

Answer / sudipta santra

select max(sal),group_nm from
( select sal,dense_rank over (order by sal desc) rank,group_nm
from emp )
where rank=&n
group by group_nm;


Note: here &n is the bind variable which holds value from
the user, based on the requirement either 2nd max or 3rd max
or 5th max.

Is This Answer Correct ?    2 Yes 1 No

how can find the second max sal for every group(i.e i want group the data based on key and find th..

Answer / nathan

SELECT *
FROM (SELECT deptno, sal,
DENSE_RANK () OVER (PARTITION BY deptno ORDER
BY sal DESC)

ranks
FROM emp)
WHERE ranks = 2;

Is This Answer Correct ?    2 Yes 1 No

Post New Answer

More Oracle General Interview Questions

How to load data from external tables to regular tables?

0 Answers  


How to define a data field as not null?

0 Answers  


What is difference between truncate and delete?

0 Answers  


Write a syntax for update query in oracle?

0 Answers  


How can I combine multiple rows into a comma-delimited list in oracle?

0 Answers  


What is the CAP theorem?

1 Answers  


Hi friends can u send the oracle 9i full version download link?????????????? please reply ?

0 Answers  


What are the factors causing the reparsing of SQL statements in SGA?

1 Answers  


How to select the name of employee who is getting maximum sal with out using subquery

15 Answers  


Explain the use of tables option in exp command.

0 Answers  


How to execute the package in oracle?

0 Answers  


How to convert characters to dates in oracle?

0 Answers  


Categories
  • Oracle General Interview Questions Oracle General (1809)
  • Oracle DBA (Database Administration) Interview Questions Oracle DBA (Database Administration) (261)
  • Oracle Call Interface (OCI) Interview Questions Oracle Call Interface (OCI) (10)
  • Oracle Architecture Interview Questions Oracle Architecture (90)
  • Oracle Security Interview Questions Oracle Security (38)
  • Oracle Forms Reports Interview Questions Oracle Forms Reports (510)
  • Oracle Data Integrator (ODI) Interview Questions Oracle Data Integrator (ODI) (120)
  • Oracle ETL Interview Questions Oracle ETL (15)
  • Oracle RAC Interview Questions Oracle RAC (93)
  • Oracle D2K Interview Questions Oracle D2K (72)
  • Oracle AllOther Interview Questions Oracle AllOther (241)