From the course: Advanced SQL for Data Science: Time Series

Unlock the full course today

Join today to access over 24,500 courses taught by industry experts.

Calculating aggregates over windows

Calculating aggregates over windows - SQL Tutorial

From the course: Advanced SQL for Data Science: Time Series

Calculating aggregates over windows

- [Instructor] A common query pattern when working with time series is to have some value from the time series compared to an aggregate value of a particular subset of the time series. So for example, you might compare CPU utilization at a point in time to the average CPU utilization for that particular server just in general. So let's look at an example like that. So let's start with a select statement and let's look at the server ID and CPU utilization, and now I want to know about the average CPU utilization, and I want to partition over the server ID, so I want to know what the average is for that particular server. And for that we'll pull from the time series schema and the utilization table. And let's keep this to a single day. And we'll use March 5th. So we'll run this query and we'll show a little bit more here, so what we see for each server, for each point in time we have a measurement, in this case CPU utilization, so we see that measurement at that point in time, but we…

Contents