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.
FROM source_spec [,...]
- source_spec
-
{ table_name [ temporal_qualifier ] [ [AS] correlation_name ] | ( subquery ) [AS] derived_table_name [ ( column_name [,...] ) ] [ temporal_qualifier ] | joined_table [ temporal_qualifier ] { CROSS JOIN single_table | [ INNER | { LEFT | RIGHT | FULL } [ OUTER ] ] JOIN joined_table [ temporal_qualifier ] ON search_condition } }
- temporal_qualifier
-
{ valid_time_qualifier [ AND transaction_time_qualifier ] | transaction_time_qualifier [ AND valid_time_qualifier ] | AS OF { date_timestamp_expression | ( date_timestamp_expression ) } }
- valid_time_qualifier
-
{ VALIDTIME AS OF { date_timestamp_expression | ( date_timestamp_expression ) } | { CURRENT | NONSEQUENCED } VALIDTIME }
- transaction_time_qualifier
-
{ TRANSACTIONTIME AS OF { date_timestamp_expression | ( date_timestamp_expression ) } | { CURRENT | NONSEQUENCED } TRANSACTIONTIME }
- table_name
- Specifies the name of a base table, temporal table, derived table, or view.
- VALIDTIME AS OF date_timestamp_expression
- VALIDTIME AS OF (date_timestamp_expression)
- Specifies that the retrieval of rows from table_name only includes rows where the period of validity overlaps the specified AS OF date or timestamp.
date_timestamp_expression can be a constant, scalar UDF, scalar subquery, or business calendar function that evaluates to a date or timestamp value.
The data type of date_timestamp_expression must be comparable with the element type of the valid-time column.
- AND
- Specifies a keyword for specifying both a valid-time AS OF qualifier and a transaction-time AS OF qualifier.
- TRANSACTIONTIME AS OF date_timestamp_expression
- TRANSACTIONTIME AS OF (date_timestamp_expression)
- Specifies that the retrieval of rows from table_name only includes rows where the transaction-time period in the rows overlaps the specified AS OF date or timestamp.
date_timestamp_expression can be a constant, scalar UDF, scalar subquery, or business calendar function that evaluates to a date or timestamp value.
The data type of date_timestamp_expression must be comparable with the element type of the transaction-time column.
- CURRENT VALIDTIME
- Specifies that the retrieval of rows from table_name includes only current rows in the valid-time dimension, which are rows having a period of validity that overlaps TEMPORAL_DATE or TEMPORAL_TIMESTAMP. The valid-time column of table_name is considered to be in the scope of the query, and can therefore be used as any other column in the table, such as in a WHERE or JOIN condition.
- NONSEQUENCED VALIDTIME
- Specifies that table_name is treated as a non-temporal table. Results in a table without a valid-time column.
- CURRENT TRANSACTIONTIME
- Specifies that the retrieval of rows from table_name includes only rows that are open in the transaction-time dimension.
- NONSEQUENCED TRANSACTIONTIME
- Specifies that table_name is treated as a non-temporal table. Results in a table without a transaction-time column.
- AS OF date_timestamp_expression
- AS OF (date_timestamp_expression)
- Specifies a date or timestamp value that qualifies the retrieval of rows from table_name in all existing time dimensions.
- [AS] correlation_name
- Specifies an alias for the table that is referenced by table_name.
- (subquery)
- Specifies the subquery that defines the derived table contents.
- [AS] derived_table_name
- Specifies an assigned name for the temporary derived table.
- column_name
- Specifies a list of column names or expressions listed in the subquery. Allows referencing subquery columns by name.
- joined_table
- Specifies either a single table name with optional alias name, or a joined table, indicating nested joins.AS OF is valid only when joined_table is a single table name with optional alias name.
- CROSS JOIN
- Specifies a cross join.
- single_table
- Specifies the name of a single base or derived table or view on a single table to be cross joined with joined_table.
- [INNER] JOIN
- Specifies a join in which qualifying rows from one table are combined with qualifying rows from another table according to some join condition.
- LEFT OUTER JOIN
- Specifies a left outer join.
- RIGHT OUTER JOIN
- Specifies a right outer join.
- FULL OUTER JOIN
- Specifies a full outer join.
- ON search_condition
- Specifies one or more conditional expressions that must be satisfied by the result rows.