What are window functions? Give real-world examples.

Window functions in SQL perform calculations across a set of rows related to the current row, without collapsing the result into a single…