i need department wise top 2 employees salary.which logic
i will use

Answer Posted / kavitha

SELECT distinct a.department_id, a.salary
FROM (SELECT department_id, salary,
DENSE_RANK () OVER (PARTITION BY department_id ORDER BY salary DESC NULLS LAST) max_sal
FROM employees
WHERE department_id IS NOT NULL) a
WHERE max_sal <= 2

Is This Answer Correct ?    5 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Hi how to import oracle sequence in Informatica? Please write stored procedure code that will import oracle sequence in Informatica SP transformation as per below scenario Oracle table product list Pro_id, pro_name 101, LED Lights. 102, 20watt CFL Lights. 103, 30 watt CFL lights Now a new flat file with new product list needs to be added to oracle table product list with oracle sequence. flat file product Prono,pro_name, 1, 20 watt tube light 2, 30 watt tube light & target should be like 101, LED Lights. 102, 20watt CFL Lights. 103, 30 watt CFL lights. 104, 20 watt tube light 105, 30 watt tube light thks reg suvarna joshi suvarnaatsuvarna@rediffmail.com

2259


What is rank () in sql?

696


Give the order of sql select?

829


What are different methods to trace the pl/sql code?

738


Which data type is a composite type?

735






Can you inner join the same table?

708


What is triggering circuit?

766


Explain cursor types?

750


How do I edit a stored procedure?

722


How would you reference column values before and after you have inserted and deleted triggers?

815


How do you sort in sql?

774


how to select unique records from a table? : Sql dba

825


Can we rollback truncate?

718


What is basic structure of pl sql?

686


List different type of expressions with the example.

698