Management & CommerceVery hardBusiness analyst · KPO · MBA placement pattern
Table emp_sales(rep, region, amount) has 8 rows: (Asha, North, 500), (Ravi, North, 700), (Meena, North, 700), (Kiran, North, 300), (Dev, South, 400), (Sara, South, 900), (John, South, 400), (Neha, South, 200). How many rows does this query return? SELECT rep FROM (SELECT rep, RANK() OVER (PARTITION BY region ORDER BY amount DESC) AS rk FROM emp_sales) t WHERE rk <= 2;
- A. 4
- B. 6
- C. 3
- D. 5
Correct answer: D. 5
North: Ravi and Meena tie at rank 1; Asha is rank 3, so 2 rows. South: Sara rank 1; Dev and John tie at 400 → both rank 2, so 3 rows. Total 5. ROW_NUMBER would return exactly 4; DENSE_RANK would also keep Asha and return 6.
Practise more Operations, Supply Chain & Business Analytics questionsOperations, Supply Chain & Business Analytics: notes and key points
More Operations, Supply Chain & Business Analytics questions
- Table daily(day, amount) has rows (1, 120), (2, 80), (3, 100), (4, 160), (5, 140). What values does AVG(amount) OVER (ORDER BY day ROWS…
- Table orders(dt, amount) has rows (1 Jan, 100), (2 Jan, 50), (2 Jan, 70), (3 Jan, 30). A query adds SUM(amount) OVER (ORDER BY dt) with no…
- Table monthly(m, mon, rev) holds Jan 200, Feb 240, Mar 210, Apr 260 (m = 1–4). A query computes ROUND(100.0 (rev − LAG(rev) OVER (ORDER BY…
- An e-commerce funnel for one month: 50,000 visits → 12,000 product views → 3,600 add-to-carts → 1,080 checkouts → 756 purchases. What is…
- Funnel: 50,000 visits → 12,000 product views (24%) → 3,600 add-to-carts (30%) → 1,080 checkouts (30%) → 756 purchases (70%). Three…
- Signup cohorts and active users — Jan: 1,000 signups; month 1: 600, month 2: 450, month 3: 400. Feb: 1,500 signups; month 1: 840, month 2…