Anchor Name Literal Expressions - Advanced SQL Engine - Teradata Database

SQL Data Manipulation Language

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

The following table lists the ANCHOR anchor_name variables for the EXPAND ON clause.

Anchor Name Description
ANCHOR_MILLISECOND Produces multiple expanded rows, one for each millisecond in the input period.
ANCHOR_SECOND Produces multiple expanded rows, one for each second in the input period.
ANCHOR_MINUTE Produces multiple expanded rows, one for each minute in the input period.
ANCHOR_HOUR Produces multiple expanded rows, one for each hour in the input period.
DAY The expansion interval is INTERVAL '1' DAY for each expanded row.
WEEK_BEGIN Produces multiple expanded rows, one for each beginning value of a week present in the input period.
WEEK_END Produces multiple expanded rows, one for each ending value of a week present in the input period.
MONTH_BEGIN Produces multiple expanded rows, one for each beginning value of a month present in the input period.

An example query that uses such expansion is “Get the month end average inventory cost during the last quarter of the year 2010."

MONTH_END Produces multiple expanded rows, one for each ending value of a month present in the input period.
QUARTER_BEGIN Produces multiple expanded rows, one for each beginning value of a quarter present in the input period.
QUARTER_END Produces multiple expanded rows, one for each ending value of a quarter present in the input period.
YEAR_BEGIN Produces multiple expanded rows, one for each beginning value of a year present in the input period.
YEAR_END Produces multiple expanded rows, one for each ending value of a year present in the input period.
MONDAY An anchor period expansion produces rows whose period beginning bounds are always aligned to specific DateTime values derived from the anchor names.

For this specification, the period beginning bound is the first Monday in the specified period.

TUESDAY The period beginning bound is the first Tuesday in the specified period.
WEDNESDAY The period beginning bound is the first Wednesday in the specified period.
THURSDAY The period beginning bound is the first Thursday in the specified period.
FRIDAY The period beginning bound is the first Friday in the specified period.
SATURDAY The period beginning bound is the first Saturday in the specified period.
SUNDAY The period beginning bound is the first Sunday in the specified period.