Postgresql Moving Average Window Functions In Sql