Session Ready
Exercise

Running totals with SUM()

One of the more powerful uses of window functions is calculating running totals: an ongoing tally of a particular value over a given stretch of time. Here, we would like to use a window function to calculate how many incidents have occurred on each date and incident type in July of 2019 as well as a running tally of the total number of incidents by incident type. A window function will help us solve this problem in one query.

Instructions
100 XP
  • Fill in the correct window function.
  • Fill in the PARTITION BY clause in the window function, partitioning by incident type ID.
  • Fill in the ORDER BY clause in the window function, ordering by incident date (in its default, ascending order).