Skip to content
Mathias Wulff edited this page Dec 15, 2025 · 3 revisions

Keyword OVER

The OVER clause defines a window or user-specified set of rows within a query result set. A window function then computes a value for each row in the window.

Syntax:

    function_name() OVER ( [ PARTITION BY column1, ... ] [ ORDER BY column2, ... ] )

AlaSQL supports:

  • ROW_NUMBER()

ROW_NUMBER()

Returns the sequential number of a row within a partition of a result set, starting at 1 for the first row in each partition.

SELECT 
    ROW_NUMBER() OVER (PARTITION BY Department ORDER BY Salary DESC) AS RowNum, 
    Name, 
    Department, 
    Salary
FROM Employees

See also: PARTITION

Clone this wiki locally