MySQLWindow FunctionsLAST_VALUE
FIRST_VALUE

LAST_VALUEWindow Functions

NTH_VALUE

Returns the last value in the window frame.

Syntax

LAST_VALUE(expr) OVER (w)

Example

Enter values below to update the example in real time.

employee_id
salary
last_sal
employees
-- 현재 윈도우 프레임의 마지막 급여
SELECT employee_id, salary,
       LAST_VALUE(salary) OVER (
         ORDER BY salary
         ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
       ) AS last_sal
FROM employees;