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 drivers in mysql? : Sql dba

572


Explain the purpose of %type and %rowtype data types?

513


What are local and global variables and their differences?

601


What has stored procedures in sql and how we can use it?

573


write an sql query to get third maximum salary of an employee from a table named employee_table. : Sql dba

553






what are the differences between public, private, protected, static, transient, final and volatile? : Sql dba

565


Can we call stored procedure in function?

562


Is postgresql a server?

583


How do you know if a relationship is 2nf?

529


how to write date and time literals? : Sql dba

540


Where is pl sql used?

528


Can we join same table in sql?

541


what is unique key constraint? : Sql dba

584


What is the difference between syntax error and runtime error?

623


What is trigger in sql and its types?

545