WITH DEFAULT Phrase Examples - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

Example: WITH DEFAULT Phrase

If the EdLev column is defined as:

EdLev BYTEINT FORMAT 'Z9' NOT NULL WITH DEFAULT,

then the column definition for EdLev is stored as:

EdLev BYTEINT NOT NULL DEFAULT 0 FORMAT 'Z9',

Example: Inserting a Row Using a Default Value

The following INSERT statement adds a row containing a zero in the EdLev field defined in the previous example:

INSERT INTO Employee
 (Name, EmpNo, DeptNo, DOB, Gender, EdLev)
 VALUES ('Newhire A', 10025, 700, '49/10/17', 'M',) ;

Example: TIME Column with a Default of the Current Time

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

Stage TIME(3) WITH DEFAULT

Example: INTERVAL Column with a Default Interval

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

Scale INTERVAL HOUR(2) WITH DEFAULT