sql window function advantages code example

Example: sql window function advantages

advantage of using Window functions over regular aggregate functions is: Window functions do not cause rows to become grouped into a single output row, the rows retain their separate identities and an aggregated value will be added to each row

Types of Window functions
========================
1. Aggregate Window Functions
		SUM(), MAX(), MIN(), AVG(). COUNT()
2. Ranking Window Functions
		RANK(), DENSE_RANK(), ROW_NUMBER(), NTILE()
3. Value Window Functions
		LAG(), LEAD(), FIRST_VALUE(), LAST_VALUE()

Tags:

Go Example