Management & CommerceHardBusiness analyst · SQL test

Customers: Asha (1), Ravi (2), Meena (3). Orders (cid, amt): (1, 300), (1, 700), (2, 450), (3, 520), (3, 100). Which names does SELECT name FROM c WHERE EXISTS (SELECT 1 FROM o WHERE o.cid = c.id AND o.amt > 500) return?

  1. A. Asha only
  2. B. Asha, Ravi and Meena
  3. C. Asha and Meena
  4. D. Meena only

Correct answer: C. Asha and Meena

EXISTS is true for a customer with at least one order above 500: Asha (700) and Meena (520). Ravi's only order is 450. Each customer appears once even if several orders qualify.

More Operations, Supply Chain & Business Analytics questions

Exams that ask this topic