task Rolling windows & frames · hard
Predict: a frame that includes peers
Predict the two running totals. RANGE includes every peer at the current credit value; ROWS walks the deterministic credits,id ordering.
what to return
- Columns
idcreditspeer_totalrow_totalin this order- Rows
- 3 rows · in the order asked
- Watch for
- Use the sample data shown here. NULL is not zero or empty text. Keep duplicate result rows.
- Skill
- Reason about the exact result of a fixed SQL query. Refresher: FIRST_VALUE, LAST_VALUE & frames →
expected result
Your query should return exactly these columns and values. Run it and compare.
expected result3 rows · in this order
| id | credits | peer_total | row_total |
|---|---|---|---|
| 3 | 50 | 50 | 50 |
| 1 | 80 | 210 | 130 |
| 2 | 80 | 210 | 210 |
all 3 rows
data you can query
Sample rows from each table. Each column shows its type underneath; → marks a link to another table.
studio_members4 columns · 4 rows
| idinteger · key | nametext | teamtext | creditsinteger |
|---|---|---|---|
| 1 | Luz | Red | 80 |
| 2 | Kit | Red | 80 |
| 3 | Remy | Blue | 50 |
| 4 | Sol | Blue | NULL |
all 4 rows
studio_bookings4 columns · 4 rows
| idinteger · key | member_idinteger → studio_members | feeinteger | booked_attext |
|---|---|---|---|
| 11 | 1 | 20 | 2026-04-01 |
| 12 | 1 | 30 | 2026-04-30 |
| 13 | 2 | NULL | 2026-05-01 |
| 14 | NULL | 20 | 2026-04-15 |
all 4 rows
This question asks you to predict an output. The prototype covers write and debug questions; open it in the current app.
Hints and the answer are always available. Using them counts the question as solved with help.