8 Week SQL Challenge - Case Study 4 (Data Allocation Challenge)
This focus area: C. Data Allocation Challenge needed a lot of brainstorming between me and Claude AI. The summary of this focus area is that the bank has decided that data allocation will be based on
The customer’s balance at the end of the previous month
On a running basis (when you request for data you get the same amount as the balance you currently have)
Amount of data received equals the customer’s average balance for the last 30 days.
The end goal is to return the total amount of data that will be required to serve the 3 approaches listed above.
Option 1: Total data required to serve customers based on their closing balance from the previous month
Get the total balance for each customer at the end of each month
Next perform a running addition for each customer per month
- Example: At the end of February, if January had a positive bank balance, that is added to the total balance for the customer in February. If the balance is negative, then it is deducted from the total in February.
Now we can perform a total SUM of each month for all customers, to get the amount of data Data Bank will need to allocate for each month for all customers it serves.