开始使用免费开始使用

多序列运行平均值

团队负责人对您为夏威夷计算运行平均值的工作印象深刻。现在他们希望获取所有站点的最低月气温的运行平均值。幸运的是,您已经掌握了快速实现的方法。

本练习是课程的一部分

PostgreSQL 中的时间序列分析

查看课程

练习说明

  • 使用窗口函数,计算不同时间序列中 t_monthly_min 的运行平均值。

交互式实操练习

通过完成这段示例代码来试试这个练习。

-- Calculate the running average of the lowest temperates for all stations
SELECT
	ts.state,
	year_month,
	t_monthly_min,
    ___ AS running_avg_temp
FROM temperatures_monthly AS tm
JOIN temperature_stations AS ts 
	USING(station_id)
ORDER BY ts.state, year_month;
编辑并运行代码