Management & CommerceVery hardBusiness analyst · KPO · MBA placement pattern
Table orders(order_id, customer, region, amount) has 7 rows: (1, Asha, North, 500); (2, Ravi, South, 300); (3, Asha, North, 200); (4, Meena, East, NULL); (5, Ravi, South, 700); (6, John, North, 400); (7, Meena, East, 350). Which customers does SELECT customer, SUM(amount) FROM orders GROUP BY customer HAVING SUM(amount) > 600; return?
- A. Ravi (700) only
- B. Asha (700) and Ravi (1000)
- C. Asha (700), Ravi (1000) and John (400)
- D. Ravi (1000) only
Correct answer: B. Asha (700) and Ravi (1000)
Totals: Asha 500 + 200 = 700; Ravi 300 + 700 = 1,000; Meena 350 (NULL ignored); John 400. HAVING keeps groups whose total exceeds 600: Asha and Ravi. 'Ravi (700) only' is what a row-level filter (WHERE amount > 600) would give.
Practise more Operations, Supply Chain & Business Analytics questionsOperations, Supply Chain & Business Analytics: notes and key points
More Operations, Supply Chain & Business Analytics questions
- Table orders(orderid, customer, region, amount) has 7 rows: (1, Asha, North, 500); (2, Ravi, South, 300); (3, Asha, North, 200); (4…
- Table orders(orderid, customer, region, amount) has 7 rows: (1, Asha, North, 500); (2, Ravi, South, 300); (3, Asha, North, 200); (4…
- Table orders(orderid, customer, region, amount) has 7 rows: (1, Asha, North, 500); (2, Ravi, South, 300); (3, Asha, North, 200); (4…
- Table orders(orderid, customer, region, amount) has 7 rows: (1, Asha, North, 500); (2, Ravi, South, 300); (3, Asha, North, 200); (4…
- Table orders(orderid, customer, region, amount) has 7 rows: (1, Asha, North, 500); (2, Ravi, South, 300); (3, Asha, North, 200); (4…
- Table orders(orderid, customer, region, amount) has 7 rows: (1, Asha, North, 500); (2, Ravi, South, 300); (3, Asha, North, 200); (4…