Databases are free to add restrictions to the OVER() clause. Sometimes, PARTITION BY [...] and / or ORDER BY [...] are mandatory sentences, depending on the aggregate function. PARTITION BY 1 may just be a dummy sentence used for syntax integrity. The following two are usually equivalent:
[aggregate function] OVER () [aggregate function] OVER (PARTITION BY 1)
Note that Sybase SQL Anywhere and CUBRID interpret this 1 as a reference to the column index, similar to what is possible in the ORDER BY [...] . This may seem a little surprising, as it imposes an evaluation order on the query projection. In your case, this would mean the following:
COUNT(*) OVER (PARTITION BY 1) COUNT(*) OVER (PARTITION BY col_a)
This curious deviation from the interpretation of other databases allows you to refer to more complex grouping expressions.
source share