Management & CommerceVery hardBusiness analyst · MBA placement
customers(id, name) has rows (1, Asha), (2, Ravi), (3, Meena), (4, Kiran). orders(oid, cid, status) has rows (10, 1, 'paid'), (11, 1, 'refunded'), (12, 2, 'paid'), (13, 3, 'refunded'). Query P: SELECT COUNT(*) FROM customers c LEFT JOIN orders o ON c.id = o.cid WHERE o.status = 'paid'. Query Q is the same but with AND o.status = 'paid' moved into the ON clause (no WHERE). What do P and Q return?
- A. P = 4, Q = 4
- B. P = 2, Q = 4
- C. P = 2, Q = 2
- D. P = 2, Q = 5
Correct answer: B. P = 2, Q = 4
P filters after the join, discarding the NULL rows of unmatched customers, so it behaves like an inner join: 2 rows. In Q the filter is part of the join condition, so every customer is kept – Asha and Ravi matched, Meena and Kiran with NULLs – giving 4.
Practise more Operations, Supply Chain & Business Analytics questionsOperations, Supply Chain & Business Analytics: notes and key points
More Operations, Supply Chain & Business Analytics questions
- A press needs a 40-minute setup before each batch and then 2 minutes per unit. It currently runs batches of 100. By what percentage does…
- A packaging line has an OEE of 60%. Its availability is 80% and its quality rate is 95%. What is its performance efficiency?
- Assembly tasks (time in seconds; immediate predecessors): A 5 (–), B 3 (A), C 4 (A), D 6 (B), E 2 (C), F 5 (D, E). Using the ranked…
- Two stages are in series. Stage 1 scraps 10% of what it processes, and Stage 2 scraps 5% of what it receives. Scrapped units are not…
- Patients arrive at 20 per hour. 60% go to station X (3 nurses, 12 minutes each), 40% go to station Y (3 doctors, 18 minutes each), and…
- At a single-server counter (M/M/1), customers arrive at 15 per hour and are served at 20 per hour. What fraction of arriving customers…