From the course: Advanced SQL for Data Science: Time Series
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
(Locked)
Common Table Expressions and recursion2m 46s
-
(Locked)
Calculating aggregates over windows1m 34s
-
(Locked)
Previous day comparison3m 50s
-
(Locked)
Moving averages1m 59s
-
(Locked)
Weighted moving averages5m 18s
-
(Locked)
Forecasting with linear regression3m 39s
-
(Locked)
Exponential moving average1m 29s
-
(Locked)
-