Dense Rank doesnt leave gaps between ranks.For example in normal Ranking operation if two people have same marks, they both would be given the same Rank, say 1.Now the next person would be given Rank 3 in regular ranking operation.In Dense Rank this person would be given Rank 2.Once ranked in a particular order through Rank function, we can then rank the rows with generator or something if you want.Maybe somone else can throw light on how to attain a Dense Ranking directly :)Regards,Annal T

DENSE_RANK calculates the number of proceeding distinct values, plus one. If multiple rows haveequal values, they all get the same rank, but there are no gaps. Each change in data value causes theranking number to be incremented by one. It's not implemented in Teradata (probably because ofperformance reasons), but can be rewritten:SELECT department_number, /*** Syntax not implemented in Teradata ***/ DENSE_RANK() OVER (PARTITION BY department_number ORDER BY salary_amount), last_name, salary_amountFROM employee;Same result using Teradata SQL:SELECT e.department_number, dt.rnk AS "DENSE_RANK", e.last_name, e.salary_amountFROM cs_views.employee eJOIN ( SELECT salary_amount, RANK() OVER (ORDER BY salary_amount) AS rnk FROM cs_views.employee GROUP BY 1 ) dtON e.salary_amount = dt.salary_amountORDER BY rnk, e.salary_amount;Probably more efficient:SELECT salary_amount, rnk, SUM(x) OVER (ORDER BY salary_amount, x DESC ROWS UNBOUNDED PRECEDING) AS "DENSE_RANK"FROM ( SELECT salary_amount, RANK() OVER (ORDER BY salary_amount) AS rnk, CASE WHEN salary_amount = MIN(salary_amount ) OVER (ORDER BY salary_amount ROWS BETWEEN 1 PRECEDING AND 1 PRECEDING) THEN 0 ELSE 1 END AS x FROM employee ) dt;SELECT salary_amount, SUM(x) OVER (ORDER BY salary_amount, x DESC ROWS UNBOUNDED PRECEDING) AS "DENSE_RANK"FROM ( SELECT salary_amount, CASE WHEN ROW_NUMBER() OVER (PARTITION BY salary_amount ORDER BY salary_amount) = 1 THEN 1 ELSE 0 END AS x FROM employee ) dt;Dieter

Dieter

I'm not sure if the first option would workSELECTe.department_number,dt.rnk AS "DENSE_RANK",e.last_name,e.salary_amountFROM cs_views.employee eJOIN(SELECTsalary_amount,RANK() OVER (ORDER BY salary_amount) AS rnkFROM cs_views.employeeGROUP BY 1) dtON e.salary_amount = dt.salary_amountORDER BY rnk, e.salary_amount;

What is DENSE_RANK? How to implement it (syntax).