Skip to content

Window/Analytic Functions would be a great addition on AlaSQL #898

Open

Description

@akashdmukherjee

Most modern relational database querying languages have window/analytic functions. These are very similar to aggregate functions, except that window functions don't alter the granularity of the dataset.

An aggregate function looks like this:

SELECT 
                product
              , MAX(earnings) as highest_earnings
FROM products
GROUP BY product;

A similar analytic function would look like this:

SELECT 
                product
              , earnings
              , MAX(earnings) OVER(PARTITION BY product) as highest_earnings
FROM products;

There's a lot of value of these as the alternative would require much longer and convoluted lines of code.

More reading here:
https://www.postgresql.org/docs/9.1/static/tutorial-window.html
https://docs.microsoft.com/en-us/sql/t-sql/queries/select-over-clause-transact-sql
https://docs.oracle.com/cd/E11882_01/server.112/e41084/functions004.htm#SQLRF06174

Activity

  1. changed the title [-]Window/Analytics Functions would be a great addition on AlaSQL[/-] [+]Window/Analytic Functions would be a great addition on AlaSQL[/+] on Jul 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions