Aggregate
BigQuery
STDDEV_SAMP
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 2026Syntax
SQL
STDDEV_SAMP(expression)Parameter
expressionnumericwajib
Kolom atau ekspresi numerik yang akan dihitung standar deviasi sampelnya
Contoh Penggunaan
Sample Standard Deviation Survei
SQL
1 SELECT 2 survey_question, 3 AVG(response_score) as avg_score, 4 STDDEV_SAMP(response_score) as score_variability, 5 COUNT(*) as response_count 6 FROM `project.dataset.survey_responses` 7 GROUP BY survey_question 8 ORDER BY score_variability DESC;
Menganalisis variabilitas jawaban survei (sampel dari populasi).
Hasil
| survey_question | avg_score | score_variability | response_count |
|---|---|---|---|
| satisfaction | 4.2 | 1.15 | 2500 |
| recommend | 4.5 | 0.89 | 2450 |
| usability | 3.8 | 1.42 | 2480 |
AB Test Analysis
SQL
1 SELECT 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 7 FROM `project.dataset.ab_test_results` 8 GROUP BY experiment_group;
Menghitung standard error untuk AB test analysis.
Hasil
| experiment_group | avg_value | value_stddev | sample_size | standard_error |
|---|---|---|---|---|
| control | 125.50 | 45.20 | 5000 | 0.64 |
| treatment | 142.30 | 48.50 | 5000 | 0.69 |
Quality Control dengan Confidence Interval
SQL
1 SELECT 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 7 FROM `project.dataset.production_samples` 8 GROUP BY product_line;
Menghitung 95% confidence interval untuk quality control.
Hasil
| product_line | mean_weight | weight_stddev | ci_lower | ci_upper |
|---|---|---|---|---|
| Product A | 500.2 | 5.5 | 499.1 | 501.3 |
| Product B | 250.5 | 3.2 | 249.9 | 251.1 |