๐ŸŽ New User? Get 20% off your first purchase with code NEWUSER20 ยท โšก Instant download ยท ๐Ÿ”’ Secure checkout Register Now โ†’
Menu

Categories

Databases Advanced

What is Window Function?

An SQL function that performs calculations across a set of rows related to the current row without collapsing the result set.

Window functions compute values over a "window" of rows defined by OVER(). Unlike GROUP BY, they do not reduce the number of rows. Common functions include ROW_NUMBER(), RANK(), DENSE_RANK(), LAG(), LEAD(), SUM() OVER(), and AVG() OVER().

Example: SELECT name, salary, AVG(salary) OVER(PARTITION BY department) as dept_avg FROM employees. Window functions are essential for running totals, rankings, moving averages, and gap-fill operations.

Related Terms

Connection String
A formatted string containing all parameters needed to establish a connection to a database server.
Database Proxy
A middleware server that sits between applications and databases, providing connection pooling, load balancing, and query routing.
Replication
The process of copying and maintaining database data across multiple servers for redundancy, failover, and read scaling.
Data Warehouse
A centralized repository optimized for analytical queries that integrates data from multiple operational sources.
Elastic Search
A distributed search and analytics engine built on Apache Lucene, optimized for full-text search and log analysis.
Redis
An open-source, in-memory data store used as a database, cache, message broker, and queue with sub-millisecond response times.
View All Databases Terms โ†’