A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.snowflake.com/en/sql-reference/functions/regr_sxx below:

Website Navigation


REGR_SXX | Snowflake Documentation

Categories:

Aggregate functions (Linear Regression) , Window function syntax and usage

REGR_SXX

Returns REGR_COUNT(y, x) * VAR_POP(x) for non-null pairs.

Syntax

Aggregate function

Window function

REGR_SXX(y, x) OVER ( [ PARTITION BY <expr3> ] )

Copy

Arguments
y

The dependent variable. This must be an expression that can be evaluated to a numeric type.

x

The independent variable. This must be an expression that can be evaluated to a numeric type.

expr3

This is the optional expression used to group rows into partitions.

Important

Note the order of the arguments; the dependent variable is first.

Usage notes Examples
CREATE OR REPLACE TABLE aggr(k INT, v DECIMAL(10,2), v2 DECIMAL(10, 2));
INSERT INTO aggr VALUES(1, 10, null);
INSERT INTO aggr VALUES(2, 10, 11), (2, 20, 22), (2, 25, null), (2, 30, 35);

SELECT k, REGR_SXX(v, v2) FROM aggr GROUP BY k;

Copy

+---+-----------------+
| k | regr_sxx(v, v2) |
|---+-----------------|
| 1 | [NULL]          |
| 2 | 288.666666667   |
+---+-----------------+

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4