Re: how to give the ranks to the students? [message #1484] |
Mon, 06 May 2002 05:49 |
|
Mahesh Rajendran
Messages: 10707 Registered: March 2002 Location: oracleDocoVille
|
Senior Member Account Moderator |
|
|
you have not clearly mentioned about which RANK ur are looking into?
if you are looking for ANALYTIC FUNCTION RANK
this will help you.
----------------------------------------------------
The following statement ranks the employees within each department based on their salary and commission. Identical salary values receive the same rank and cause nonconsecutive ranks.
SQL> SELECT deptno, ename, sal, comm,
2 RANK() OVER (PARTITION BY deptno ORDER BY sal DESC, comm) as rk
3 FROM emp;
DEPTNO ENAME SAL COMM RK
---------- ---------- ---------- ---------- ----------
10 KING 5000 1
10 CLARK 2450 2
10 MILLER 1300 3
20 SCOTT 3000 1
20 FORD 3000 1
20 JONES 2975 3
20 ADAMS 1100 4
20 SMITH 800 5
30 BLAKE 2850 1
30 ALLEN 1600 300 2
30 TURNER 1500 0 3
30 WARD 1250 500 4
30 MARTIN 1250 1400 5
30 JAMES 950 6
14 rows selected.
SQL>
--------------------------------------------------
if you are looking into conventional rank based on marks use a decode funtion and compute the rank.!!.
|
|
|
|