Management & CommerceVery hardBusiness analytics · SQL · MBA placement
cust has rows (1, Asha), (2, Ravi), (3, Meena). ord(oid, cid, status) has (10, 1, 'paid'), (11, 1, 'due'), (12, 2, 'due'). How many rows does each query return? P: SELECT c.name, o.oid FROM cust c LEFT JOIN ord o ON c.id = o.cid AND o.status = 'paid'; Q: SELECT c.name, o.oid FROM cust c LEFT JOIN ord o ON c.id = o.cid WHERE o.status = 'paid';
- A. P = 1, Q = 1
- B. P = 4, Q = 1
- C. P = 3, Q = 1
- D. P = 3, Q = 3
Correct answer: C. P = 3, Q = 1
In P the filter is part of the join, so every customer is kept: Asha with order 10, and Ravi and Meena with NULLs (3 rows). In Q the WHERE runs after the join and removes rows whose status is NULL or 'due', leaving only Asha's order 10, which silently turns the left join into an inner join.
Practise more Operations, Supply Chain & Business Analytics questionsOperations, Supply Chain & Business Analytics: notes and key points
More Operations, Supply Chain & Business Analytics questions
- orders(oid, cust, amount): (1, A, 100), (2, A, 200), (3, A, 600), (4, B, 300), (5, B, 500), (6, C, 900). How many rows does this return?…
- A1 holds 95. What does =IFS(A1>=50, "C", A1>=70, "B", A1>=90, "A", TRUE, "F") return?
- x values 2, 4, 6, 8, 10 are in A2:A6 and y values 30, 34, 35, 41, 45 in B2:B6. What does =FORECAST.LINEAR(12, B2:B6, A2:A6) return?
- A spare part sells in only about one week out of five, but when it does, it sells 3–20 units. A simple exponential-smoothing forecast…
- A distributor classifies SKUs not only by annual value (ABC) but also by how variable their demand is: steady (X), fluctuating (Y) and…
- A furniture maker keeps standard frames and fabrics in stock but sews and assembles each sofa only after the customer chooses the fabric…