Ledger and graph analytics
Two row-count hazards:
- Required accounts disappear after filtering.
- Graph nodes appear several times through different paths.
State the required output population before writing SQL.
1 / 6
Two row-count hazards:
State the required output population before writing SQL.
Which accounts appear, and with what balances?
Answers: (10,650), (20,0), (30,0).
ON, or use conditional aggregation.COALESCE for a null sum.A later WHERE e.status = 'posted' removes accounts 20 and 30.
COALESCE cannot recover a group already removed.
Seed A; edges A→B, A→C, B→C, C→A, C→D, D→E.
| working depth | discoveries |
|---|---|
| 0 | A |
| 1 | B, C |
| 2 | C, A, D |
Predict the final minimum depth of each account. Is E included?
Final depths: A=0, B=1, C=1, D=2. E is absent.
WHERE hop_depth < 2 stops expansion.GROUP BY account_id with MIN(hop_depth) combines paths.UNION alone does not merge (A,0) with (A,2).Complete both exercises, then explain your choices in the checkpoint.