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 delete a column in an existing table?

595


What is a snapshot log?

564


How to view existing locks on the database?

553


Define the SGA and: How you would configure SGA for a mid-sized OLTP environment? What is involved in tuning the SGA?

1860


defination of bitmap index

1631






What is catalog in Oracle?

652


How to connect to the server with user account: sys?

566


Difference between cartesian join and cross join?

543


What is an Oracle Instance?

687


Explain about integrity constraint?

606


How to drop an existing table in oracle?

594


What are nested tables?

674


What is difference between cartesian join and cross join?

591


How to get a list of all user accounts in the database?

617


What are the components of logical database structure in oracle database?

583