Example: Sorting Employees by Name and Company Seniority Using RANK (Teradata) - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Sort employees alphabetically and identify their level of seniority in the company.

SELECT EmployeeName, (HireDate - CURRENT_DATE) AS ServiceDays,
RANK(ServiceDays) AS Seniority
FROM Employee
ORDER BY EmployeeName;

The result may look like the following table.

EmployeeName Service Days Seniority
Ferneyhough 9931 2
Lucier 9409 4
Revueltas 9408 5
Ung 9931 2
Wagner 10248 1