From the course: Advanced SQL – Window Functions

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

How window functions fit in query processing

How window functions fit in query processing - SQL Tutorial

From the course: Advanced SQL – Window Functions

Start my 1-month free trial

How window functions fit in query processing

- [Instructor] As we just saw, evaluation scope of standard expressions is limited to their own rows. We can create a new expression from existing ones but only from those that are on the same row. If we need to use a value from another row, we have no choice but to use a subquery. So to list the name of the second animal from the same species next to the current one, we must write this whole mess of a subquery. We must handle NOWs and probably need an aspirin afterwards. Well, had no choice is a more accurate term. Because this is exactly the limitation that window functions overcome. As their name suggests, window functions open a new window to other rows that can be accessed directly without a subquery. For every row we can use a window function to peek at values from other rows. But before we start coding window functions, we first need to understand their place. Window functions are limited to the select and order…

Contents