Both Conditions
Return the id of every trade that is a buy (side is buy) at a price below 50. Rows may come in any order.
Example 1
trades
| id | symbol | side | qty | price |
|---|---|---|---|---|
| 1 | KO | buy | 10 | 49.5 |
| 2 | KO | sell | 5 | 40.0 |
| 3 | XOM | buy | 7 | 50.0 |
| 4 | XOM | buy | 2 | 12.25 |
returns
| id |
|---|
| 1 |
| 4 |
Constraints
- Up to 14 trades
sideisbuyorsell
Write it in your browser, against the clock. The model query, with a note on each piece of it, comes after.
More SQL problems
- Cheapest FirstBeginner
- Each Symbol OnceBeginner
- How Many SellsBeginner
- No ManagerBeginner
- One SymbolBeginner
- One of SeveralBeginner
- Only the Big OnesBeginner
- Starts With ABeginner