콘텐츠로 이동

COVAR_POP는 숫자 쌍 집합의 모공분산을 반환합니다.

func.covar_pop(<expr1>, <expr2>)
func.covar_pop(table.units_sold, table.revenue).alias('covar_pop_units_revenue')
| covar_pop_units_revenue |
|-------------------------|
| 20000.0 |
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_revenue
FROM product_sales;

결과

| covar_pop_units_revenue |
|-------------------------|
| 20000.0 |