Why is ORDER BY mandatory in many window functions?
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: easy
Interview Round: Other
Overview: A SQL question on why window functions such as ROW_NUMBER, RANK, LAG and LEAD need ORDER BY inside the OVER clause. It tests understanding of row order, default window frames, nondeterminism from ties, and when a partition-wide aggregate can skip the ordering.