Instruction
Excellent! Let's review what we've learned in this part:
- You can define a window frame within
OVER(...). The syntax is:[ROWS|RANGE] <WindowFrameDefinition>
ROWSalways treats rows individually (like theROW_NUMBER()function)RANGEalways adds rows that share the same value in the column we order by (like theRANK()function).- The
<WindowFrameDefinition>is defined byBETWEEN <LowerBound> AND <UpperBound>, where the bounds are defined using:UNBOUNDED PRECEDING,n PRECEDING(ROWSonly),CURRENT ROW,n FOLLOWING(ROWSonly),UNBOUNDED FOLLOWING
- Remember that if
<UpperBound>is equal toCURRENT ROW, you can use abbreviations and omit the<UpperBound>[ROWS|RANGE] UNBOUNDED PRECEDING[ROWS] n PRECEDING[ROWS|RANGE] CURRENT ROW
So, are you ready for a short quiz?
Exercise
Click to continue.



