12 Matching Annotations
  1. Jun 2021
  2. Feb 2021
  3. Nov 2020
    1. So far, all the grouping we've done is according to the unique values within a column or set of columns (using PARTITION BY). However, you can do even fancier things by making the group relative to each row. In other words, as SQL runs through each row, it will perform a calculation for the surrounding rows. This allows you to do things like get a sum for only the 5 previous rows. Here is a diagram that demonstrates which rows SQL will consider (in purple) when it reaches a given row (in aqua), if we tell it to look at the 5 previous rows:

  4. Oct 2020
  5. Sep 2020
  6. Jun 2020
  7. May 2020