Management & CommerceHardBusiness analytics · SQL · MBA placement
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? SELECT oid FROM orders o WHERE amount > (SELECT AVG(amount) FROM orders WHERE cust = o.cust);
- A. 3
- B. 1
- C. 4
- D. 2
Correct answer: D. 2
The subquery is correlated, so each order is compared with its own customer's average: A's average is 300 (order 3 qualifies), B's 400 (order 5), and C's 900 (900 is not greater than itself). Two rows. Comparing with the overall average of about 433 would give 3.
Practise more Operations, Supply Chain & Business Analytics questionsOperations, Supply Chain & Business Analytics: notes and key points
More Operations, Supply Chain & Business Analytics questions
- 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…
- According to Marshall Fisher, which pairing of product type and supply chain is the best match?