17.05 - Anchor Name Literal Expressions - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Manipulation Language

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
Release Date
January 2021
Content Type
Programming Reference
Publication ID
B035-1146-175K
Language
English (United States)

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.