Asterisks in Select Lists - Advanced SQL Engine - Teradata Database

Temporal Table Support

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
cjo1556732840654.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1182
lifecycle
previous
Product Category
Teradata Vantage™

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.