Management & CommerceHardBusiness analyst · SQL test
prod(pid, name) has Pen (1), Book (2) and Bag (3); sales(pid, qty) has rows (1, 5), (1, 3), (2, 4). How many rows do these return? P: SELECT p.name FROM prod p JOIN sales s ON p.pid = s.pid; Q: SELECT name FROM prod WHERE pid IN (SELECT pid FROM sales).
- A. P = 2, Q = 2
- B. P = 3, Q = 3
- C. P = 2, Q = 3
- D. P = 3, Q = 2
Correct answer: D. P = 3, Q = 2
The join repeats Pen once per matching sales row (2) plus Book (1) = 3 rows. IN only tests membership, so each product appears at most once: Pen and Book = 2. Use IN or EXISTS when you want the list of products, not the sales rows.
Practise more Operations, Supply Chain & Business Analytics questionsOperations, Supply Chain & Business Analytics: notes and key points
More Operations, Supply Chain & Business Analytics questions
- Daily demand is normal. About what percentage of days have demand within 1.5 standard deviations of the mean? (Φ(1.5) ≈ 0.9332.)
- A team compares two suppliers' processes for the same part: Process P has Cp = 1.8 and Cpk = 0.9; Process Q has Cp = 1.3 and Cpk = 1.25…
- An item is ordered 20 times a year. Holding cost is ₹8 per unit per year and each unit short costs ₹30. Expected units short per cycle for…
- A single-server desk (M/M/1) has λ = 8 per hour and μ = 10 per hour. In an M/M/1 queue, time in system is exponential with mean 1/(μ − λ)…
- A clinic with 3 doctors receives 12 patients an hour. On average there are 6 patients in the clinic, of whom 4 are waiting (not with a…
- For an assembly line, which statement about the feasible range of cycle time is correct?