Aggregate

STDDEV_SAMP

BigQueryBigQuery

Menghitung standar deviasi sampel dari nilai numerik. Menggunakan formula pembagi N-1 (Bessel's correction), cocok untuk data sampel yang merepresentasikan populasi lebih besar.

Tipe hasil: FLOAT64Diperbarui: 7 Jan 2026

Syntax

SQL
STDDEV_SAMP(expression)

Parameter

expressionnumericwajib

Kolom atau ekspresi numerik yang akan dihitung standar deviasi sampelnya

Contoh Penggunaan

Sample Standard Deviation Survei

SQL
1SELECT
2 survey_question,
3 AVG(response_score) as avg_score,
4 STDDEV_SAMP(response_score) as score_variability,
5 COUNT(*) as response_count
6FROM `project.dataset.survey_responses`
7GROUP BY survey_question
8ORDER BY score_variability DESC;

Menganalisis variabilitas jawaban survei (sampel dari populasi).

Hasil
survey_questionavg_scorescore_variabilityresponse_count
satisfaction4.21.152500
recommend4.50.892450
usability3.81.422480

AB Test Analysis

SQL
1SELECT
2 experiment_group,
3 AVG(conversion_value) as avg_value,
4 STDDEV_SAMP(conversion_value) as value_stddev,
5 COUNT(*) as sample_size,
6 STDDEV_SAMP(conversion_value) / SQRT(COUNT(*)) as standard_error
7FROM `project.dataset.ab_test_results`
8GROUP BY experiment_group;

Menghitung standard error untuk AB test analysis.

Hasil
experiment_groupavg_valuevalue_stddevsample_sizestandard_error
control125.5045.2050000.64
treatment142.3048.5050000.69

Quality Control dengan Confidence Interval

SQL
1SELECT
2 product_line,
3 AVG(weight_grams) as mean_weight,
4 STDDEV_SAMP(weight_grams) as weight_stddev,
5 AVG(weight_grams) - 1.96 * STDDEV_SAMP(weight_grams) / SQRT(COUNT(*)) as ci_lower,
6 AVG(weight_grams) + 1.96 * STDDEV_SAMP(weight_grams) / SQRT(COUNT(*)) as ci_upper
7FROM `project.dataset.production_samples`
8GROUP BY product_line;

Menghitung 95% confidence interval untuk quality control.

Hasil
product_linemean_weightweight_stddevci_lowerci_upper
Product A500.25.5499.1501.3
Product B250.53.2249.9251.1