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)

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