16.20 - Example - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Functions, Expressions, and Predicates

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Release Date
March 2019
Content Type
Programming Reference
Publication ID
B035-1145-162K
Language
English (United States)

The following SELECT statement:

SELECT lname, serviceyrs,
 DENSE_RANK()OVER(ORDER BY serviceyrs)
 FROM schooltbl
 GROUP BY 1,2;

returns the ordered ranking by service years for teachers listed in schooltbl.

lname serviceyrs DENSE_RANK
Adams 10 1
Peters 10 1
Murray 10 1
Rogers 15 2
Franklin 16 3
Smith 20 4
Ford 20 4
Derby 20 4
Baker 25 5