← All topics
Quiz: Window Functions: questions with answers
10 questions, each with the answer and a short explanation.
Take the timed quiz + get a certificate →- Q1. Salaries 100, 90, 90, 80 ordered DESC. What RANK does 80 get?
- Q2. Same salaries. What DENSERANK does 80 get?
- Q3. What does PARTITION BY do inside OVER()?
- Q4. Which function returns the value from the previous row?
- Q5. Why can't you write WHERE ROWNUMBER() OVER (...) = 1?
- Q6. In the company table, what is the 4th highest DISTINCT salary (DENSERANK = 4)?
- Q7. LEAD(salary) OVER (ORDER BY joined) — what does it show for Om, who joined just before Arjun?
- Q8. How many rows does SELECT name, AVG(salary) OVER (PARTITION BY deptid) FROM employees return for the 7 employees?
- Q9. You need the top 2 earners in every department. Which filter goes in the outer query?
- Q10. Why add a tie-breaker such as name to ROWNUMBER() OVER (ORDER BY salary DESC, name)?