At many instances, the user would really like to check the worth of the present row with the worth of the subsequent row. To resolve this problem the best option is the next window function:
LEAD ( scalar_expression [ ,offset ] , [ default ] )
OVER ( [ partition_by_clause ] order_by_clause ) - Accesses data from a subsequent row in the same result set without the use of a self-join starting with SQL Server 2012 (11.x). LEAD provides access to a row at a given physical offset that follows the current row. Use this analytic function in a SELECT statement to compare values in the current row with values in a following row.
🔥PLEASE LIKE and SUBSCRIBE🔥 - this will boost our motivation to create even more amazing videos.
Be a SQL HERO!
Use this 👉 #SQL #dataengineering #dataanalytics #datascience #database #data #programming