Low and High
Return each symbol once with low, the lowest price among its trades, and high, the highest. Rows may come in any order.
Example 1
trades
| id | symbol | qty | price |
|---|---|---|---|
| 1 | AAPL | 10 | 190.5 |
| 2 | MSFT | 5 | 410.0 |
| 3 | AAPL | 7 | 188.0 |
| 4 | AAPL | 1 | 193.0 |
returns
| symbol | low | high |
|---|---|---|
| AAPL | 188.0 | 193.0 |
| MSFT | 410.0 | 410.0 |
Constraints
- Up to 16 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
- Net PositionEasy
- Orders With NamesEasy
- Pay With BonusEasy
- Small, Medium, LargeEasy
- Total per SymbolEasy
- Totals by MonthEasy
- Above the AverageMedium
- Best Paid in Each DepartmentMedium