MySQLWindow FunctionsLEAD
LAG

LEADWindow Functions

FIRST_VALUE

Returns the value from n rows after the current row.

Syntax

LEAD(expr, n, default) OVER (w)

Example

Enter values below to update the example in real time.

order_month
revenue
next_revenue
monthly_sales
-- 다음 달 목표 미리 보기
SELECT order_month, revenue,
       LEAD(revenue, 1) OVER (ORDER BY order_month) AS next_revenue
FROM monthly_sales;