Lead

Description: LEAD provides access to a row at a given physical offset beyond that position.

LEAD(<expression, offset, default>)
[(<query_partition_clause>)]
OVER (<order_by_clause>)
 
SELECT submit_date, num_votes,
LEAD(num_votes, 1, 0) OVER (ORDER BY submit_date) AS NEXT_VAL
FROM votes;

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.