Slide 34
Slide 34 text
37
Amzon Timestreamの関数を利⽤したSQL
SELECT
fleet,
truck_id,
fuel_capacity,
model,
load_capacity,
make,
measure_name,
BIN(time, 1h) AS binned_timestamp,
ROUND(AVG(load), 2) AS avg_1hour_load,
ROUND(AVG("fuel-reading"), 2) AS "avg_1hour_fuel-reading",
ROUND(AVG(speed), 2) AS avg_1hour_speed
FROM
"kaneyasu-timestream-multi"."IoTMulti"
WHERE
time BETWEEN ago(2h) AND ago(1h)
GROUP BY
fleet, truck_id, fuel_capacity, model, load_capacity, make, measure_name, BIN(time, 1h)
ORDER BY
binned_timestamp ASC
⼀時間ごとに各列の平均値を求めるSQL