Analytic Functions


The LAG function in SQL is used to access data from a previous row in the result set. It allows you to compare values in the current row with values in the previous row, making it a valuable tool for time-based analysis and trend identification. SYNTAX EXAMPLE above it can be seen that we have […]

LAG Read More »


NTILE is a window function that divides an ordered dataset into a specified number of approximately equal groups, assigning a unique rank to each row within those groups. This is particularly useful when you want to distribute data evenly, analyze percentiles, or create buckets for further analysis. SYNTAX EXAMPLE 1: Distributing Sales Data EXAMPLE 2:

NTILE() Read More »


SYNTAX PARTITION BY clause The PARTITION BY clause is used to divide the result set from the query into data subsets, or partitions. if the PARTITION BY clause is not use, the entire result of the query is a partition. Range:UNBOUNDED PREDEDING AND CURRENT ROW OR RANGE UNBOUNDED PREDEDINGCURRENT ROW AND UNBOUNDED FOLLOWING OR RANGE

OVER() Read More »

Scroll to Top