Databases & SQL vocabulary · SQL Statements and Queries

Window function

Meaning in databases & SQL, with examples

nounAdvanced term

In databases & SQL, window function means: A SQL function that calculates a value across a set of related rows, such as a running total or a rank, while still returning every individual row.

In Turkish: pencere fonksiyonu, analitik fonksiyon

How it is used

Written with OVER, often with PARTITION BY and ORDER BY: ROW_NUMBER() OVER (PARTITION BY customer_id ORDER BY created_at). Common ones are ROW_NUMBER, RANK, LAG, LEAD and SUM OVER. Unlike GROUP BY, rows are not collapsed. Oracle calls them analytic functions.

Example sentences

  1. Use a window function to get each customer's most recent order.

  2. The running balance column is calculated with a window function over the transactions.

Common collocations

  • window function
  • OVER (PARTITION BY ...)
  • ROW_NUMBER()
  • running total

This word in other fields

The same English word can have a different meaning in another field:

More terms: SQL Statements and Queries

Practise with graded reading

Reading at the right level is the fastest way to make new words stick. Pick free English books by level: