From the course: Advanced SQL – Window Functions

Unlock the full course today

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

Frame offset window functions

Frame offset window functions - SQL Tutorial

From the course: Advanced SQL – Window Functions

Start my 1-month free trial

Frame offset window functions

- [Instructor] Like the row offset functions, frame offset functions require a mandatory value to fetch expression. Nth value also requires an offset specification. Nth value supports an optional from first or from last clause, which determines whether the offset is evaluated from the beginning or from the end of the frame. The default is from first. Ignore and respect nulls work the same way as they did for row offset functions. Partitioning is optional, but framing is mandatory. Note that the order by is used both for the frame definition and also for the offset evaluation of nth value. Wouldn't it be nice if the frame and nth value could use different sort orders. As for the frame definition, mandatory is a bit of a strong word as we can omit it and specify only the order by. I highly recommend that you don't, as if you do, a frame will be assumed for you and it happens to be the same unfortunate one we saw for…

Contents