Example

Teradata Vantageā„¢ SQL Functions, Expressions, and Predicates

brand
Software
Teradata Vantage
prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1145-162K

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 might look like the following table.

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