17.05 - Syntax - Teradata Database

Teradata Vantage™ - Temporal Table Support

prodname
Advanced SQL Engine
Teradata Database
vrm_release
17.00
17.05
created_date
June 2020
category
Programming Reference
featnum
B035-1182-170K
Teradata Vantage™ - Temporal Table Support describes syntax that is especially relevant to temporal tables. Syntax that is not required, or that is not otherwise specific to temporal tables is generally not shown in this document. For additional syntax, see Teradata Vantage™ - SQL Data Definition Language Syntax and Examples, B035-1144 , Teradata Vantage™ - SQL Data Manipulation Language, B035-1146 , and Teradata Vantage™ - SQL Data Control Language, B035-1149.
{ CREATE | REPLACE } VIEW
  [ database_name. | user_name. ] view_name [ ( column_name [,...] ) ]
  AS { [ temporal_qualifier ] select_statement |
       ( [ temporal_qualifier ] select_statement )
     } [;]
To ensure application portability to ANSI standards for temporal SQL, Teradata recommends explicit specification of all temporal qualifiers.
temporal_qualifier
{ valid_time_qualifier [ AND transaction_time_qualifier ] |

  transaction_time_qualifier [ AND valid_time_qualifier ] |

  AS OF date_timestamp_expression
}
valid_time_qualifier
{ CURRENT VALIDTIME |

  VALIDTIME AS OF date_timestamp_expression |

  { [ SEQUENCED | NONSEQUENCED ] VALIDTIME } [ period_expression ]
}
transaction_time_qualifier
{ { CURRENT | SEQUENCED | NONSEQUENCED } TRANSACTIONTIME |

  TRANSACTIONTIME AS OF date_timestamp_expression
}
view_name
Specifies the name of the view.
database_nameuser_name
Specifies the name of the database or user to contain view_name if something other than the current database or user.
column_name
Specifies the name of a view column. If more than one column is specified, list their names in the order in which each column is to be displayed for the view.
CURRENT VALIDTIME
Specifies that select_statement is a current query in the valid-time dimension. The result set is a nontemporal table.
VALIDTIME AS OF date_timestamp_expression
Specifies that select_statement retrieves rows where the period of validity overlaps the specified AS OF expression. The result set is a nontemporal table.

date_timestamp_expression can be a constant, scalar UDF, scalar subquery, or business calendar function that evaluates to a date or timestamp value.

VALIDTIME SEQUENCED VALIDTIME
Specifies that select_statement is a sequenced query. The result set is a valid-time table that includes an extra column for the overlapped valid-time period. If the list of columns for the view does not provide a name for the extra column, the default name is “VALIDTIME”.
If select_statement is a sequenced query in the valid-time and transaction-time dimensions, and the list of columns for the view provides names for the extra columns, the first extra name is the name of the resulting valid-time column and the second extra name (if it exists) is the name of the resulting transaction-time column.
NONSEQUENCED VALIDTIME
Specifies that select_statement is a nonsequenced query in the valid-time dimension. If period_expression is specified, the nonsequenced query produces a table with valid time; otherwise, the result set is a nontemporal table.
The result set for a valid-time table includes an extra column for the overlapped valid-time period. If the list of columns for the view does not provide a name for the extra column, the default name is “VALIDTIME”.
If select_statement is a nonsequenced query in the valid-time dimension and sequenced in the transaction-time dimension, and the list of columns for the view provides names for the extra columns, the first extra name is the name of the resulting valid-time column and the second extra name (if it exists) is the name of the resulting transaction-time column.
period_expression
Specifies the period of applicability for the sequenced or nonsequenced query.
CURRENT TRANSACTIONTIME
Specifies that select_statement is a current query in the transaction-time dimension. The result set is a nontemporal table.
TRANSACTIONTIME AS OF date_timestamp_expression
Specifies that select_statement retrieves rows whose transaction-time period in the row overlaps the specified AS OF expression. The result set is a nontemporal table.

date_timestamp_expression can be a constant, scalar UDF, scalar subquery, or business calendar function that evaluates to a date or timestamp value.

SEQUENCED TRANSACTIONTIME
Specifies that select_statement is a sequenced query in the transaction-time dimension. The result set is a table with transaction time.
There can only be one table referenced in select_statement and the table must have transaction time.
NONSEQUENCED TRANSACTIONTIME
Specifies that select_statement is a nonsequenced query in the transaction-time dimension. A nonsequenced query produces a nontemporal table as a result set.
AS OF date_timestamp_expression
Specifies that select_statement retrieves rows whose valid-time and transaction-time periods overlap the specified AS OF expression.

date_timestamp_expression can be a constant, scalar UDF, scalar subquery, or business calendar function that evaluates to a date or timestamp value.

select_statement
Specifies the existing SELECT statement syntax.