SELECT for Time Series Tables | Teradata Vantage - 17.00 - SELECT - Teradata Database

Teradata Vantageā„¢ - Time Series Tables and Operations

Advanced SQL Engine
Teradata Database
June 2020
Programming Reference

When querying PTI tables, you can use the GROUP BY TIME clause. See GROUP BY TIME Clause. For complete information about SELECT, see Teradata Vantageā„¢ - SQL Data Manipulation Language, B035-1146.

When referencing a PTI table in a SELECT statement:
  • Specifying SELECT * from a PTI table defined with a TD_TIMEBUCKET column returns all of the columns in the table except for the system generated TD_TIMEBUCKET column.
  • When querying PTI tables, you can specify the system generated TD_TIMECODE and TD_SEQNO columns in the SELECT statement.
  • You cannot specify the system generated TD_TIMEBUCKET column in a SELECT statement. However, you can use the TD_GETTIMEBUCKET() function to obtain TD_TIMEBUCKET data. See TD_GETTIMEBUCKET.
  • The BETWEEN logical predicate is inclusive of the lower and upper bounds, which can span multiple time bucket boundaries. If you specify GROUP BY TIME (HOURS(1)), each time bucket only includes the lower bound of the one hour time range. A timestamp of 08:00:00 is in one timebucket and a timestamp of 09:00:00 is in the next time bucket. For example, if you specify BETWEEN 08:00:00 AND 09:00:00 and one hour time buckets are defined, that is,HOURS(1), rows from two time buckets can be returned.
  • As with any SELECT statement, you must specify an order, otherwise rows are returned unordered. For example, SELECT * FROM table_name ORDER BY column_name.