Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: add "AS" for alias b_sum, remove a line break, fix a typo

...

There can be multiple OVER clauses in a single query. A singe single OVER clause only applies to the immediately preceding function call:

Code Block
languagesql
SELECT
 a,
 COUNT(b) OVER (PARTITION BY c),
 SUM(b) OVER (PARTITION BY c)
FROM T;

...

Code Block
languagesql
SELECT a,
 COUNT(b) OVER (PARTITION BY c) AS b_count,
 SUM(b) OVER (PARTITION BY c) AS b_sum
FROM T;

WINDOW clause

...