MySQL STDDEV() function
STDDEV() function
MySQL STDDEV() function returns the population standard deviation of expression.
The STDDEV() function is used to calculate statistical information for a specified numeric field in a query. It returns NULL if no matching rows found.
This function is useful in -
- It's used when you have a sample of data and want to estimate the variability in the entire population.
- STDDEV() quantifies the spread or dispersion of values around the mean (average) in a sample.
- When analyzing sample data, STDDEV() helps you assess the distribution of values and identify potential outliers or anomalies within the sample.
- When comparing different samples or groups, STDDEV() is used to assess the significance of differences between the groups.
- In some quality control processes, sample standard deviation helps assess the variability in products or processes.
- Sample standard deviation is used to calculate confidence intervals for population parameters based on sample data.
Syntax:
STDDEV(expr);
Where expr is an expression.
MySQL Version: 8.0
Example: MySQL STDDEV() function
The following MySQL statement returns the standard deviation of 'total_cost' from purchase table.
Sample table: purchase
Code:
SELECT STDDEV(total_cost)
FROM purchase;
Output:
mysql> SELECT STDDEV(total_cost) -> FROM purchase; +--------------------+ | STDDEV(total_cost) | +--------------------+ | 315.392172 | +--------------------+ 1 row in set (0.00 sec)
Previous:
STDDEV_SAMP()
Next:
MySQL Aggregate Functions and Grouping - SUM()
- Weekly Trends
- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join
We are closing our Disqus commenting system for some maintenanace issues. You may write to us at reach[at]yahoo[dot]com or visit us at Facebook