17.10 - Example - Advanced SQL Engine - Teradata Database

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

Advanced SQL Engine
Teradata Database
Release Number
Release Date
July 2021
Content Type
Programming Reference
Publication ID
English (United States)

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