Paid and refunded side by side

SQLHard13 min

Your task

For each customer who has at least one order, return name, paid_cents and refunded_cents in a single row each. Customers with none of one kind show 0.

Tables

customer
idINTEGERnameTEXTcountryTEXTsigned_upTEXT
1AnkaDE2025-12-20
2BoUS2025-12-14
3CyUS2026-01-05
4DaraJP2026-02-01
orders
idINTEGERcustomer_idINTEGERplaced_onTEXTtotal_centsINTEGERstatusTEXT
112026-01-0412000paid
212026-01-193500refunded
322026-01-2189000paid
422026-02-0215000paid
532026-02-144200pending
622026-02-2822000paid
More rows not shown