items_sold = number of order line items of the brand; items_returned = number of DISTINCT line items of the brand that appear in item_returns (the returns system sometimes logs the same item twice). Only brands with at least 3 items sold are reported. Return brand, items_sold, items_returned and return_rate_pct = 100 * items_returned / items_sold, ROUND to 1. Order by return_rate_pct DESC, then brand.
| Column | Type |
|---|---|
| product_id | INTEGER |
| brand | TEXT |
| product_id | brand |
|---|---|
| 1 | Roadster |
| 2 | Roadster |
| 3 | HRX |
| 4 | Mango |
| 5 | Mango |
| Column | Type |
|---|---|
| item_id | INTEGER |
| order_id | INTEGER |
| product_id | INTEGER |
| price | REAL |
| item_id | order_id | product_id | price |
|---|---|---|---|
| 101 | 1 | 1 | 799 |
| 102 | 1 | 3 | 1299 |
| 103 | 2 | 2 | 599 |
| 104 | 3 | 1 | 799 |
| 105 | 3 | 3 | 1299 |
| 106 | 4 | 3 | 1299 |
| 107 | 5 | 4 | 2499 |
| 108 | 6 | 1 | 799 |
| Column | Type |
|---|---|
| return_id | INTEGER |
| item_id | INTEGER |
| return_date | DATE |
| return_id | item_id | return_date |
|---|---|---|
| 1 | 101 | 2026-02-03 |
| 2 | 104 | 2026-02-10 |
| 3 | 105 | 2026-02-11 |
| 4 | 107 | 2026-02-12 |
| 5 | 101 | 2026-02-15 |
| brand | items_sold | items_returned | return_rate_pct |
|---|---|---|---|
| Roadster | 4 | 2 | 50 |
| HRX | 3 | 1 | 33.3 |
Solve it in the live editor on this page — run on sample data, then submit against hidden tests.
‹ Sessionize App Events and Cart Conversion · Users Active in 3+ Consecutive Months ›
{{ 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.