TD_TIMEBUCKET Example | Teradata Vantage - Example: Get a TD_TIMEBUCKET Value from a TD_TIMEBUCKET Column - Analytics Database - Teradata Vantage

Time Series Tables and Operations

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2023-10-30
dita:mapPath
tuc1628112453431.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
sfz1493079039055
lifecycle
latest
Product Category
Teradata Vantageā„¢
create table ocean_buoys(buoyid integer, salinity integer, temperature integer)
PRIMARY TIME INDEX(TIMESTAMP(6), DATE '2016-04-19', HOURS(1));

Result:

-- The following two adjcent SELECT statements should return the same output:
SELECT td_gettimebucket(td_timecode) from ocean_buoys;
SELECT td_gettimebucket(ocean_buoys.td_timecode) from ocean_buoys;
 
TD_GETTIMEBUCKET(TD_TIMECODE)
-----------------------------
289
  
 
-- The column title contains TIMEBUCKET_COL.
SELECT td_gettimebucket(ocean_buoys.td_timecode) as TimeBucket_COL from ocean_buoys;
 
TIMEBUCKET_COL
--------------
           289
 
SELECT buoyid FROM ocean_buoys WHERE td_gettimebucket(td_timecode) > 200;
 
BUOYID
------
   101