HOW TO DISPLAY MAXIMUM SALARIES FROM EMP DEPARTMENT VISE ALONG
WITH DEPARTMENT NAMES? E.g EMP,DEPT

Answer Posted / selvaraj v

In oracle 10g :

SELECT * FROM
(SELECT DEPTNO,
EMPNO,
ENAME,
SAL,
DENSE_RANK() OVER(PARTITION BY DEPTNO ORDER BY SAL
DESC) RANK
FROM EMP);

OUTPUT :
------------>

DEPTNO EMPNO ENAME SAL RANK
---------- ---------- ---------- ---------- ----------
10 7839 KING 5000 1
10 7782 CLARK 2450 2
10 7934 MILLER 1300 3
20 7788 SCOTT 3000 1
20 7902 FORD 3000 1
20 7566 JONES 2975 2
20 7876 ADAMS 1100 3
20 7369 SMITH 800 4
30 7698 BLAKE 2850 1
30 7499 ALLEN 1600 2
30 7844 TURNER 1500 3

DEPTNO EMPNO ENAME SAL RANK
---------- ---------- ---------- ---------- ----------
30 7521 WARD 1250 4
30 7521 WARD 1250 4
30 7654 MARTIN 1250 4
30 7900 JAMES 950 5

15 rows selected.

Is This Answer Correct ?    0 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to grant create session privilege to a user in oracle?

574


What are the types of trigger in oracle?

581


How can we force the database to use the user specified rollback segment?

563


What is the difference between view and materialized view in Oracle?

618


What is the difference between hot backup and cold backup in oracle? Tell about their benefits also.

551






15. Display the item_cost and then truncate it to the nearest hundred, ten, unit, tenth and hundredth.

1715


How to export data to a csv file?

632


What exactly do quotation marks around the table name do?

554


How to use group functions in the select clause using oracle?

602


How to see free space of each tablespace?

598


How to create a stored function in oracle?

593


what is IDE,DMV in sql server?

2260


What are data pump export and import modes?

617


What is the difference between post-database commit and post-form commit?

521


Can we connect to ORACLE db using Windows Authentication?

731