Management & CommerceVery hardBusiness analyst · SQL test
Table e(name, s) has salaries A 90, B 90, C 80, D 70. What do these return? P: SELECT DISTINCT s FROM e ORDER BY s DESC LIMIT 1 OFFSET 1; Q: SELECT s FROM e ORDER BY s DESC LIMIT 1 OFFSET 1.
- A. P = 90, Q = 80
- B. P = 80, Q = 80
- C. P = 80, Q = 90
- D. P = 70, Q = 80
Correct answer: C. P = 80, Q = 90
Without DISTINCT the sorted list is 90, 90, 80, 70, so skipping one row gives 90 again. With DISTINCT it is 90, 80, 70, and skipping one gives 80 – the true second-highest salary.
Practise more Operations, Supply Chain & Business Analytics questionsOperations, Supply Chain & Business Analytics: notes and key points
More Operations, Supply Chain & Business Analytics questions
- A column holds the names Sara, Raman, Ria, Kavya and Ana. How many of them match LIKE '%a' (assume a case-insensitive comparison)?
- A firm orders 1,000 units at a time. At this quantity its annual holding cost is ₹6,000 and its annual ordering cost is ₹3,000. Without…
- A three-server bank counter (M/M/3) has arrivals of 24 per hour and each teller serves 10 per hour. On average, how many tellers are busy?
- A ward has 20 beds, the average length of stay is 4 days and the hospital targets 85% average occupancy. How many admissions per day can…
- Products A and B use machines M1 and M2, each available 480 minutes a day. A needs 4 min on M1 and 2 min on M2; B needs 2 min on M1 and 5…
- Simple exponential smoothing is run with α = 1. What does the forecast for next period equal?