COVAR_POP (Lakehouse v1)
COVAR_POP は、数値ペアの集合の母共分散を返します。
Analyzeの構文
Section titled “Analyzeの構文”func.covar_pop(<expr1>, <expr2>)Analyzeの例
Section titled “Analyzeの例”func.covar_pop(table.units_sold, table.revenue).alias('covar_pop_units_revenue')
| covar_pop_units_revenue ||-------------------------|| 20000.0 |SQLの構文
Section titled “SQLの構文”COVAR_POP(<expr1>, <expr2>)| 引数 | 説明 |
|---|---|
<expr1> |
任意の数値式 |
<expr2> |
任意の数値式 |
float64
テーブルの作成とサンプルデータの挿入
CREATE TABLE product_sales ( id INT, product_id INT, units_sold INT, revenue FLOAT);
INSERT INTO product_sales (id, product_id, units_sold, revenue)VALUES (1, 1, 10, 1000), (2, 2, 20, 2000), (3, 3, 30, 3000), (4, 4, 40, 4000), (5, 5, 50, 5000);クエリのデモ: 販売数量と売上の母共分散を計算する
SELECT COVAR_POP(units_sold, revenue) AS covar_pop_units_revenueFROM product_sales;結果
| covar_pop_units_revenue ||-------------------------|| 20000.0 |