16.20 - 例: TD_SEQUENCED_AVGの使用 - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL日付と時刻の関数および式

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
プログラミング リファレンス
featnum
B035-1211-162K-JPN
WITH subtbl(flight_id, charges, duration) AS
     (SELECT flight_id, charges, duration FROM FlightExp)
SELECT * FROM TABLE (
     TD_SYSFNLIB.TD_SEQUENCED_AVG(NEW VARIANT_TYPE(subtbl.flight_id),
          NEW VARIANT_TYPE(subtbl.charges),
                           subtbl.duration)
RETURNS (flight_id INT, charges FLOAT,
     duration PERIOD(TIMESTAMP(6) WITH TIME ZONE))
HASH BY flight_id /* input data is redistributed on column, flight_id */
LOCAL ORDER BY flight_id, duration) /* input data is sorted on these columns */
AS DT(flight_id, charges, duration) ORDER BY 1,3;