17.00 - Example: Using the System Virtual Columns in a Query - Teradata Database

Teradata Vantageā„¢ - Time Series Tables and Operations

prodname
Advanced SQL Engine
Teradata Database
vrm_release
17.00
created_date
June 2020
category
Programming Reference
featnum
B035-1208-170K
SELECT $TD_TIMECODE_RANGE, $TD_GROUP_BY_TIME, BUOYID, AVG(TEMPERATURE)
FROM OCEAN_BUOYS
WHERE TD_TIMECODE BETWEEN TIMESTAMP '2014-01-06 08:00:00' AND TIMESTAMP '2014-01-06 10:00:00'
GROUP BY TIME(MINUTES(30) AND BUOYID);

Result:

TIMECODE_RANGE GROUP BY TIME (MINUTES(30)) BUOYID AVG (TEMPERATURE)
('2014-01-06 09:00:00.000000+00:00', '2014-01-06 09:30:00.000000+00:00') 3 1 74
('2014-01-06 08:00:00.000000+00:00', '2014-01-06 08:30:00.000000+00:00') 1 0 55