Ordered analytics over window frames
The recipe will provide you with insight into Snowflake's ability to run ordered or simple analytics over subsets of rows. Such analytics are typically used in marketing analytics applications, where moving average or cumulative functions are applied to data to identify trends. These capabilities help data scientists wrangle large datasets.
Getting ready
Note that this recipe's steps can be run either in the Snowflake WebUI or the SnowSQL command-line client. We shall be generating data that we intend to use in this recipe. The dataset will have three columns: customer_id
, deposit_dt
, and deposit
. This data will capture deposits that have been made by a customer on a particular date.
How to do it…
Let's start by generating some sample data. We shall create a view with the logic to generate data:
- The following query will be used to generate base data that will be used to implement a view. We will be using...