By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
6 rows affected
| month_nb | customer_id | new_credits | debit | starting_balance |
|---|---|---|---|---|
| 1 | A | 250 | -62 | 250 |
| 2 | A | 250 | -84 | 438 |
| 3 | A | 250 | -8 | 500 |
| 4 | A | 210 | -400 | 500 |
| 5 | A | 210 | -162 | 310 |
| 6 | A | 210 | 0 | 358 |