SQL: Analytic Function LAG and LEAD

Опубликовано: 03 Март 2026
на канале: Study Desk of Anand
97
17

SQL: Analytic Function LAG and LEAD
In this video, we will see analytic function LAG and LEAD with a problem statement.
 
SQL queries:

select c.*,
LAG( revenue, 1, 0) over ( partition by name order by year) previous_revenue,
LEAD(revenue, 1, 0) over ( partition by name order by year ) next_revenue
from company_revenue c