Window
Snowflake
RATIO_TO_REPORT
Menghitung rasio nilai terhadap total dalam partition.
Tipe hasil:
DOUBLEDiperbarui: 6 Jan 2026Syntax
SQL
RATIO_TO_REPORT(expr) OVER ([PARTITION BY ...])Parameter
exprnumericwajib
Expression numerik
Contoh Penggunaan
Sales Percentage
SQL
1 SELECT 2 product_name, 3 sales, 4 RATIO_TO_REPORT(sales) OVER () as pct_of_total, 5 RATIO_TO_REPORT(sales) OVER (PARTITION BY category) as pct_of_category 6 FROM products;
Persentase sales dari total dan per kategori.