Net revenue excludes refunded sales (`refunded` = 1). For each app category and calendar year with revenue, return `category`, `year` (integer), `revenue` (ROUND 2) and `yoy_pct` = ROUND(100.0 * (revenue - prev) / prev, 1), where prev is the same category's revenue in the immediately previous calendar year; NULL if that year has no revenue row. Order by `category`, `year`.
| Column | Type |
|---|---|
| app_id | INTEGER |
| app_name | TEXT |
| category | TEXT |
| app_id | app_name | category |
|---|---|---|
| 1 | Pixel Quest | Games |
| 2 | Tile Rush | Games |
| 3 | BeatLab | Music |
| 4 | Fold Notes | Productivity |
| 5 | Snap Edit | Photo |
| Column | Type |
|---|---|
| sale_id | INTEGER |
| app_id | INTEGER |
| sale_date | DATE |
| amount | REAL |
| refunded | BOOLEAN |
| sale_id | app_id | sale_date | amount | refunded |
|---|---|---|---|---|
| 1 | 1 | 2024-03-01 | 100 | 0 |
| 2 | 2 | 2024-07-01 | 50 | 0 |
| 3 | 1 | 2025-02-01 | 200 | 0 |
| 4 | 2 | 2025-05-01 | 80 | 1 |
| 5 | 1 | 2026-01-15 | 180 | 0 |
| 6 | 3 | 2024-04-04 | 40 | 0 |
| 7 | 3 | 2026-06-06 | 60 | 0 |
| category | year | revenue | yoy_pct |
|---|---|---|---|
| Games | 2024 | 150 | NULL |
| Games | 2025 | 200 | 33.3 |
| Games | 2026 | 180 | -10 |
| Music | 2024 | 40 | NULL |
| Music | 2026 | 60 | NULL |
Solve it in the live editor on this page — run on sample data, then submit against hidden tests.
‹ Device Upgrade Cycle by Product Line · Sensor Online Periods ›
{{ 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.