Management & CommerceHardBusiness analyst · SQL test
cust(id, name) has rows (1, Asha), (2, Ravi), (3, Meena), (4, Kiran), (5, Dev). ord(oid, cid, amt, dt) has rows (1, 1, 500, 2 Jan), (2, 1, 300, 5 Jan), (3, 3, 200, 3 Jan), (4, 3, 200, 3 Jan), (5, 5, 900, 4 Jan), (6, 1, 100, 9 Jan). Which names does SELECT c.name FROM cust c LEFT JOIN ord o ON c.id = o.cid WHERE o.oid IS NULL return?
- A. Asha, Meena and Dev
- B. Ravi and Kiran
- C. No rows
- D. Ravi, Kiran and Dev
Correct answer: B. Ravi and Kiran
The LEFT JOIN keeps every customer; customers with no order get NULLs in the ord columns. Filtering WHERE o.oid IS NULL keeps exactly those – Ravi (2) and Kiran (4). This 'anti-join' finds customers who never ordered.
Practise more Operations, Supply Chain & Business Analytics questionsOperations, Supply Chain & Business Analytics: notes and key points
More Operations, Supply Chain & Business Analytics questions
- cust(id, name) has rows (1, Asha), (2, Ravi), (3, Meena), (4, Kiran), (5, Dev). ord(oid, cid, amt, dt) has rows (1, 1, 500, 2 Jan), (2, 1…
- cust(id, name) has rows (1, Asha), (2, Ravi), (3, Meena), (4, Kiran), (5, Dev). ord(oid, cid, amt, dt) has rows (1, 1, 500, 2 Jan), (2, 1…
- A table has 10 rows with x = 1 to 10. NTILE(4) OVER (ORDER BY x) splits them into quartile buckets. How many rows fall into buckets 1, 2…
- sal(name, dept, s) has rows: dept X – A 90, B 90, C 80, D 70; dept Y – E 60, F 50, G 50, H 40. How many rows have DENSERANK() OVER…
- An A/B test must detect a lift in conversion from 10% to 12% with α = 0.05 (two-sided) and 80% power. Using n ≈ (1.96 + 0.84)² × [p₁(1 −…
- Jobs arrive at an M/M/1 workstation at 10 per hour. Waiting (in the system) costs ₹100 per job per hour, and service capacity costs ₹40…