Management & CommerceVery hardBusiness analyst · SQL test
Using the same table v, what does CASE WHEN amt >= 100 THEN 'High' WHEN amt >= 50 THEN 'Mid' ELSE 'Low' END return for customers C and D?
- A. C: Mid; D: NULL
- B. C: Mid; D: Low
- C. C: High; D: Low
- D. C: Low; D: NULL
Correct answer: B. C: Mid; D: Low
CASE takes the first branch that is true. For C (50), the first test fails and the second succeeds: 'Mid'. For D (NULL), both comparisons are unknown, not true, so the ELSE branch applies: 'Low'. Without an ELSE it would return NULL.
Practise more Operations, Supply Chain & Business Analytics questionsOperations, Supply Chain & Business Analytics: notes and key points
More Operations, Supply Chain & Business Analytics questions
- Using table v, how many rows do these return? P: SELECT FROM v WHERE amt > 60; Q: SELECT city, SUM(amt) FROM v GROUP BY city HAVING…
- Table m(store, mon, rev) has S1: month 1 = 100, month 2 = 120, month 3 = 90; S2: month 1 = 200, month 2 = 180. What does rev − LAG(rev)…
- Using table v (where Goa's only row has amt NULL), what do SELECT SUM(amt) FROM v WHERE city = 'Goa' and SELECT COALESCE(SUM(amt), 0) FROM…
- A subscription business started the quarter with 1,000 customers, gained 200 new customers during the quarter and ended with 1,050…
- While solving a transportation problem with 3 sources and 4 destinations, an initial solution has only 5 occupied cells. What should be…
- In the Hungarian method for a 5 × 5 assignment problem, after row and column reductions all zeros can be covered by 4 lines. What does…