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

Answer Posted / neetika vardhan

SELECT dept, MAX(sal)
FROM EMP WHERE sal NOT IN (SELECT MAX(sal) FROM emp GROUP
BY dept)
GROUP BY dept

UNION

SELECT dept, MAX(sal)
FROM EMP
GROUP BY dept

Is This Answer Correct ?    17 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the 3 modes of parameter?

675


What is a natural join?

512


How do I view an execution plan in sql?

525


What does (*) mean in sql?

527


What are the parameter modes supported by pl/sql?

532






What is tuple in sql?

540


Difference between truncate, delete and drop commands?

556


What is difference between primary and secondary key?

515


Can we have two clustered index on a table?

559


How do I save the results of sql query in a file?

533


How many functions are there in sql?

535


What does the base_object_type column shows in the user.triggers data dictionary view?

568


what is a composite key ? : Sql dba

596


Is pl sql still used?

505


How to select unique records from a table?

567