I'm not as familiar with SQL aggregation, but if it supports multiple stages of operations then I could see there being plenty of practical applications when applied to groups. An example would be...
I'm not as familiar with SQL aggregation, but if it supports multiple stages of operations then I could see there being plenty of practical applications when applied to groups.
An example would be first grouping rows by month, then subtracting the total of the previous month from the total of the current month in order to obtain a series of deltas. This data could be useful for telling you how much of some metric you've lost or gained over each month. A subsequent stage could then filter by negative deltas to show only losses. A practical concrete example might be telling you which quarters your sales dipped in, so you can examine the causes of profit loss.
Use cases can be difficult to come up with, but generally if you need to compare X number of results relative to the current one, then preceding and following are likely the tools you'll want to use.
An interesting SQL window functions quiz I have found recently.
running averages are very interesting, thanks.
I'm not as familiar with SQL aggregation, but if it supports multiple stages of operations then I could see there being plenty of practical applications when applied to groups.
An example would be first grouping rows by month, then subtracting the total of the previous month from the total of the current month in order to obtain a series of deltas. This data could be useful for telling you how much of some metric you've lost or gained over each month. A subsequent stage could then filter by negative deltas to show only losses. A practical concrete example might be telling you which quarters your sales dipped in, so you can examine the causes of profit loss.
Use cases can be difficult to come up with, but generally if you need to compare X number of results relative to the current one, then preceding and following are likely the tools you'll want to use.