Small, Medium, Large
Label every trade by its quantity: large from 1000 up, medium from 100 up, small below that. Return each trade's id and its label as size. Rows may come in any order.
Example 1
trades
| id | symbol | qty | price |
|---|---|---|---|
| 1 | AAPL | 1000 | 190.5 |
| 2 | MSFT | 999 | 410.0 |
| 3 | AAPL | 100 | 191.0 |
| 4 | KO | 99 | 61.2 |
| 5 | KO | 5000 | 61.3 |
returns
| id | size |
|---|---|
| 1 | large |
| 2 | medium |
| 3 | medium |
| 4 | small |
| 5 | large |
Constraints
- Up to 14 trades
Write it in your browser, against the clock. The model query, with a note on each piece of it, comes after.
More SQL problems
- Total per SymbolEasy
- Totals by MonthEasy
- Above the AverageMedium
- Best Paid in Each DepartmentMedium
- Bought but Never SoldMedium
- Change From the Day BeforeMedium
- First OrderMedium
- Latest PriceMedium