17.05 - Asterisks in Select Lists - 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

For nontemporal tables, an asterisk (*) in a select list causes all table columns to be returned by the SELECT statement. For temporal tables with any qualifier other than nonsequenced, only the nontemporal columns from the original table are returned. To have temporal columns from the original table returned with SELECT statements that use the asterisk to return all nontemporal columns, preface the asterisk with the table name and a period, and follow the asterisk with a comma, then list the temporal columns (or component columns of a temporal column defined as a derived period type) to be returned with the nontemporal columns.

Example: Using asterisks in select lists

SELECT *
FROM policy;
Policy_ID  Customer_ID  Policy_Type  Policy_Details
---------  -----------  -----------  ------------------
   541077    766492008  AU           STD-CH-344-YXY-00
   541008    246824626  AU           STD-CH-345-NXY-00
   541145    616035020  AU           STD-CH-348-YXN-01

SELECT policy.*, validity
FROM Policy;

Policy_ID  Customer_ID  Policy_Type  Policy_Details    Validity
---------  -----------  -----------  ----------------- ------------------------
541077     766492008    AU           STD-CH-344-YXY-00 ('09/12/21', '99/12/31')
541008     246824626    AU           STD-CH-345-NXY-00 ('09/10/01', '99/12/31')
541145     616035020    AU           STD-CH-348-YXN-01 ('09/12/03', '10/12/01')
Valid-time columns cannot be referenced in SEQUENCED VALIDTIME queries that include a period of applicability.