16.20 - 例 - Teradata Vantage NewSQL Engine

Teradata Vantage™ 時系列テーブルおよび操作

prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
プログラミング リファレンス
featnum
B035-1208-162K-JPN

例: 同順位なしでのBOTTOMの使用

/*PTI Table*/
SELECT $TD_TIMECODE_RANGE, $TD_GROUP_BY_TIME, BUOYID, BOTTOM(2, TEMPERATURE)
FROM OCEAN_BUOYS
WHERE TD_TIMECODE BETWEEN TIMESTAMP '2014-01-06 10:00:00' AND TIMESTAMP '2014-01-06 10:06:00' AND BUOYID=44
GROUP BY TIME (MINUTES(2) AND BUOYID) FILL(NULLS)
ORDER BY 1, 4, 3;

/*Non-PTI Table*/
SELECT $TD_TIMECODE_RANGE, $TD_GROUP_BY_TIME, BUOYID, BOTTOM(2, TEMPERATURE)
FROM OCEAN_BUOYS_NONPTI
WHERE TIMECODE BETWEEN TIMESTAMP '2014-01-06 10:00:00' AND TIMESTAMP '2014-01-06 10:06:00' AND BUOYID=44
GROUP BY TIME (MINUTES(2) AND BUOYID)
USING TIMECODE(TIMECODE)
FILL(NULLS)
ORDER BY 1, 4, 3;

結果は、両方のテーブルで同じです。

TIMECODE_RANGE GROUP BY TIME (MINUTES(10)) BUOYID BOTTOM(2, TEMPERATURE)
('2014-01-06 10:00:00.000000+00:00', '2014-01-06 10:02:00.000000+00:00') 1 44 43
('2014-01-06 10:00:00.000000+00:00', '2014-01-06 10:02:00.000000+00:00') 1 44 43
('2014-01-06 10:02:00.000000+00:00', '2014-01-06 10:04:00.000000+00:00') 2 44 53
('2014-01-06 10:02:00.000000+00:00', '2014-01-06 10:04:00.000000+00:00') 2 44 53
('2014-01-06 10:04:00.000000+00:00', '2014-01-06 10:06:00.000000+00:00') 3 44 ?

例: 同順位ありでのBOTTOMの使用

/*PTI Table*/
SELECT $TD_TIMECODE_RANGE, $TD_GROUP_BY_TIME, BUOYID, BOTTOM WITH TIES(2, TEMPERATURE)
FROM OCEAN_BUOYS
WHERE TD_TIMECODE BETWEEN TIMESTAMP '2014-01-06 10:00:00' AND TIMESTAMP '2014-01-06 10:06:00' AND BUOYID=44
GROUP BY TIME (MINUTES(2) AND BUOYID) FILL(NULLS)
ORDER BY 1, 4, 3;


/*Non-PTI Table*/
SELECT $TD_TIMECODE_RANGE, $TD_GROUP_BY_TIME, BUOYID, BOTTOM WITH TIES(2, TEMPERATURE)
FROM OCEAN_BUOYS_NONPTI
WHERE TIMECODE BETWEEN TIMESTAMP '2014-01-06 10:00:00' AND TIMESTAMP '2014-01-06 10:06:00' AND BUOYID=44
GROUP BY TIME (MINUTES(2) AND BUOYID)
USING TIMECODE(TIMECODE)
FILL(NULLS)

結果は、両方のテーブルで同じです。

TIMECODE_RANGE GROUP BY TIME (MINUTES(10)) TIMECODE BUOYID TEMPERATURE
('2014-01-06 10:00:00.000000+00:00', '2014-01-06 10:02:00.000000+00:00') 1 2014-01-06 10:00:24.000000 44 43
('2014-01-06 10:00:00.000000+00:00', '2014-01-06 10:02:00.000000+00:00') 1 2014-01-06 10:00:24.333300 44 43
('2014-01-06 10:00:00.000000+00:00', '2014-01-06 10:02:00.000000+00:00') 1 2014-01-06 10:00:25.122200 44 43
('2014-01-06 10:00:00.000000+00:00', '2014-01-06 10:02:00.000000+00:00') 1 2014-01-06 10:00:26.122200 44 43
('2014-01-06 10:02:00.000000+00:00', '2014-01-06 10:04:00.000000+00:00') 2 2014-01-06 10:02:25.122200 44 53
('2014-01-06 10:02:00.000000+00:00', '2014-01-06 10:04:00.000000+00:00') 2 2014-01-06 10:03:25.122200 44 53
('2014-01-06 10:04:00.000000+00:00', '2014-01-06 10:06:00.000000+00:00') 3 ? 44 ?