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). What does SELECT region, COUNT(*) FROM orders WHERE amount > 250 GROUP BY region HAVING COUNT(*) >= 2; return?
- A. North 2, South 2 and East 1
- B. North 3 and South 2
- C. South 2 only
- D. North 2 and South 2
Correct answer: D. North 2 and South 2
WHERE runs first and keeps amounts above 250: orders 1 (N), 2 (S), 5 (S), 6 (N) and 7 (E); order 3 (200) and the NULL fail. Groups: North 2, South 2, East 1. HAVING COUNT(*) ≥ 2 drops East. North 3 counts order 3, which WHERE has already removed.
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…
- A consumer-electronics firm's quarterly figures (₹ crore unless stated), Q1 to Q4: revenue 240, 270, 300, 330; cost of goods sold 150…