SQL Window Functions

Window functions can be categorized into one of three types as shown in the table below:-

Types of window function

Aggregate function

An aggregate function is a function where the values of multiple rows are grouped together as input on certain criteria to form a single value of more
significant meaning.
Various Aggregate Functions
1) Count()
2) Sum()
3) Avg()
4) Min()
5) Max()

Ranking function

RANK functions to specify rank for individual fields as per the categorizations. It returns an aggregated value for each participating row.
Various RANK Functions
1) ROW_NUMBER()
2) RANK()
3) DENSE_RANK()
4) NTILE()

Analytic function

Analytic functions calculate an aggregate value based on a group of rows and return multiple rows for each group.
Various Analytic Functions
1) FIRST_VALUE()
2) LAST_VALUE()
3) LAG()
4) LEAD()

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nidhi Gupta

Nidhi Gupta

490 Followers

Database Engineer 👨‍💻.Heading towards cloud technologies✌️.