Window Function

 Categories of widow function

1. Aggregated fun : avg, sum , max, min , count

2. Ranking func :  Rank, dense_rank, row_number

3. Analytical func : Lead, Lag, first_value, last_value



Lag : Return previous row and depends on offset

LAG ( expression [, offset [, default] ] )

OVER ( [ query_partition_clause ] order_by_clause )


Lead : Return next row and depends on offset.

LEAD( expression [, offset [, default] ] )

OVER ( [ query_partition_clause ] order_by_clause )


Comments

Popular posts from this blog

Sequence

Stored Procedure