Exclude sales with status 'RETURNED'. For each category return `category`, `revenue` (ROUND 2) and `share_pct` = ROUND(100.0 * category revenue / total revenue of all non-returned sales, 1). Order by `revenue` DESC, then `category`.
| Column | Type |
|---|---|
| sale_id | INTEGER |
| category | TEXT |
| amount | REAL |
| status | TEXT |
| sale_id | category | amount | status |
|---|---|---|---|
| 1 | Mobiles | 500 | DELIVERED |
| 2 | Mobiles | 300 | DELIVERED |
| 3 | Fashion | 200 | DELIVERED |
| 4 | Fashion | 150 | RETURNED |
| 5 | Books | 100 | DELIVERED |
| 6 | Home | 200 | DELIVERED |
| category | revenue | share_pct |
|---|---|---|
| Mobiles | 800 | 61.5 |
| Fashion | 200 | 15.4 |
| Home | 200 | 15.4 |
| Books | 100 | 7.7 |
Solve it in the live editor on this page — run on sample data, then submit against hidden tests.
‹ Restaurants Inactive in October · Sign-in Failure Rate by Tenant Domain ›
{{ totalCount }} questions in the style asked at Amazon, Microsoft, Google, Meta, Flipkart and more — {{ hardPct }}% Hard. Write SQL in a real database engine in your browser, run it on sample data, then evaluate against hidden tests.
Company tags show where this type of question is commonly reported in interviews. Questions, data and solutions are written by TechTown.
{{ cur.statement }}
No submissions yet. Press Evaluate to submit your query.
{{ solutionSql }}
{{ out.error }}
You have solved your 3 free questions — nice work! Log in (free) to unlock all 150 questions, keep your streak and appear on the leaderboard.