Each order as a share of the total
SQLMedium12 min
Your task
For paid orders, return id, total_cents and pct_of_all, the order as a percentage of all paid revenue, rounded to one decimal. Order by id.
Tables
customer| idINTEGER | nameTEXT | countryTEXT | signed_upTEXT |
|---|
| 1 | Anka | DE | 2025-12-20 |
| 2 | Bo | US | 2025-12-14 |
| 3 | Cy | US | 2026-01-05 |
| 4 | Dara | JP | 2026-02-01 |
orders| idINTEGER | customer_idINTEGER | placed_onTEXT | total_centsINTEGER | statusTEXT |
|---|
| 1 | 1 | 2026-01-04 | 12000 | paid |
| 2 | 1 | 2026-01-19 | 3500 | refunded |
| 3 | 2 | 2026-01-21 | 89000 | paid |
| 4 | 2 | 2026-02-02 | 15000 | paid |
| 5 | 3 | 2026-02-14 | 4200 | pending |
| 6 | 2 | 2026-02-28 | 22000 | paid |
More rows not shown Model answerRun