FIRST_VALUE and LAST_VALUE in Oracle
Oracle中的FIRST_VALUE和LAST_VALUE
These are Oracle analytical functions used to return the first value or the last value from a set of ordered rows. These functions can get the first value or the last value within a column in a table. The only argument that can be passed to these functions is the column name. To use these functions we must use the ORDER BY clause. A partition by clause can be used but not required to use these functions. The functions are identical and the only difference is the name.
这些是Oracle分析函数,用于从一组有序行中返回第一个值或最后一个值。 这些函数可以获取表中列中的第一个值或最后一个值。 可以传递给这些函数的唯一参数是列名。 要使用这些功能,我们必须使用ORDER BY子句。 可以使用partition by子句,但不需要使用这些功能。 功能相同,唯一的区别是名称。
Syntax for FIRST_VALUE and LAST_VALUE:
FIRST_VALUE和LAST_VALUE的语法:
FIRST_VALUE (<<COLUMN NAME >>) OVER (ORDER BY <<COLUMN NAME >> )
LAST_VALUE (<<COLUMN NAME >>) OVER (ORDER BY <<COLUMN NAME >> )