Question DB-SQL-0048
MediumWhat does this query return for the table below?
Table orders:
| id | customer | city | amount | status |
|---|---|---|---|---|
| 1 | Ravi | Pune | 1200 | shipped |
| 2 | Meena | Delhi | 800 | pending |
| 3 | Ravi | Pune | 450 | shipped |
| 4 | Kiran | Mumbai | 2000 | cancelled |
| 5 | Meena | Delhi | 1500 | shipped |
| 6 | Arjun | Pune | NULL | pending |
| 7 | Kiran | Mumbai | 700 | shipped |
SELECT customer, MAX(amount) FROM orders GROUP BY customer HAVING COUNT(*) = 2 ORDER BY customer;
- A.
Kiran | 700, Meena | 800, Ravi | 450
- B.
Kiran | 2000, Meena | 1500, Ravi | 1200, Arjun | NULL
- C.
Sign up free to see the answer and a step-by-step explanation.