Aggregate
BigQuery
CORR
Menghitung koefisien korelasi Pearson antara dua kolom numerik.
Tipe hasil:
FLOAT64Syntax
SQL
CORR(x, y)Parameter
xFLOAT64wajib
Kolom numerik pertama
yFLOAT64wajib
Kolom numerik kedua
Contoh Penggunaan
Calculate Correlation
SQL
1 SELECT CORR(price, quantity) AS price_qty_corr 2 FROM sales;
Korelasi antara harga dan kuantitas.
Hasil
price_qty_corr: -0.75
Correlation by Category
SQL
1 SELECT 2 category, 3 CORR(ad_spend, revenue) AS roi_correlation 4 FROM marketing 5 GROUP BY category;
Korelasi ad spend dengan revenue per kategori.
Hasil
(correlations by category)