17.10 - Examples - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - Data Types and Literals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1143-171K
Language
English (United States)

Example: Numeric

Suppose the DeptNo column is defined in table Departments as follows.

CREATE TABLE Departments
   (DeptName CHARACTER(36)
   ,DeptNo SMALLINT DEFAULT 100 FORMAT '999' BETWEEN 100 AND 900
   ,ManagerID INTEGER);

When the value for the DeptNo field is not provided in an INSERT statement, then the value 100 with type SMALLINT is inserted automatically.

Example: Date Literal

The following example shows a DATE column specified with a DEFAULT date literal:

F4 DATE DEFAULT DATE '2000-01-01'

Example: Current Time

The following example shows a TIME column specified with a DEFAULT of the current time:

Stage TIME(3) DEFAULT CURRENT_TIME(3)

Example: Interval

The following example shows an INTERVAL column specified with a DEFAULT interval:

Scale INTERVAL YEAR(2) DEFAULT INTERVAL -'10' YEAR