From the course: Advanced SQL – Window Functions
Unlock the full course today
Join today to access over 24,800 courses taught by industry experts.
Row offset window functions - SQL Tutorial
From the course: Advanced SQL – Window Functions
Row offset window functions
- [Instructor] All Offset functions require a mandatory expression for what we want to fetch from the other row. Row Offset functions have two additional optional parameters. First is an Offset value and the second is a Default value replacement. The Default is used in case the Offset points to outside the partition boundaries or to a row that doesn't exist. If Offset is not specified, one is assumed. If a default is not specified, NULL will be used. IGNORE and RESPECT NULLS determine whether rows with NULL expressions are counted towards the Offset. The Default is RESPECT NULLS. Following are the optional PARTITION BY clause and the mandatory ORDER BY clause. Remember the ORDER BY in this case does not imply framing. And in fact, we can't specify a frame even if we really wanted to. Here is a row set ordered by the green column in ascending order. We're currently evaluating the highlighted third row. A lead with an…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.