Management & CommerceHardBusiness analyst · SQL test
Table a has key values 1, NULL and 2; table b has key values 1, NULL and 3. How many rows does SELECT * FROM a JOIN b ON a.k = b.k return?
- A. 2
- B. 1
- C. 3
- D. 0
Correct answer: B. 1
Only the rows with key 1 match. NULL = NULL is unknown, not true, so the two NULL keys do not join to each other; 2 and 3 have no partners. Joining NULLs requires an explicit condition such as a.k IS NOT DISTINCT FROM b.k.
Practise more Operations, Supply Chain & Business Analytics questionsOperations, Supply Chain & Business Analytics: notes and key points
More Operations, Supply Chain & Business Analytics questions
- Customers: Asha (1), Ravi (2), Meena (3). Orders (cid, amt): (1, 300), (1, 700), (2, 450), (3, 520), (3, 100). Which names does SELECT…
- Table r(region, rev) has N 200, S 300, E 500. What does ROUND(100.0 rev / SUM(rev) OVER (), 1) return for region S?
- A January cohort of 1,000 sign-ups has 600 active users in month 1 and 450 in month 2. An analyst reports 'month-2 retention of 75%'. What…
- A retailer buys a seasonal item at ₹60 and sells it at ₹100; unsold units are cleared at ₹20. Each unit of unmet demand also costs an…
- A machine runs batches of 100 units at 1 minute per unit. A SMED project cuts the changeover from 60 to 20 minutes, and the batch size is…
- A single-server help desk (M/M/1) receives 8 requests an hour and serves 10 an hour. If the server's speed is doubled to 20 an hour, what…