Syntax
STDDEV_SAMP(expr)
Purpose
You can call this function to return the sample standard deviation of expr. The result returned by this function is the square root of the result returned by the VAR_SAMP() function. For more information about VAR_SAMP(), see VAR_SAMP.
If no matching row is found, it returns NULL.
Examples
obclient> CREATE TABLE employees (manager_id INT,last_name VARCHAR(50),hiredate VARCHAR(50),salary INT);
INSERT INTO employees VALUES(100, 'Raphaely', '2017-07-01', 1700);
INSERT INTO employees VALUES(100, 'De Haan', '2018-05-01',11000);
INSERT INTO employees VALUES(100, 'Errazuriz', '2017-07-21', 1400);
INSERT INTO employees VALUES(100, 'Hartstein', '2019-05-01',14000);
INSERT INTO employees VALUES(100, 'Raphaely', '2017-07-22', 1700);
INSERT INTO employees VALUES(100, 'Weiss', '2019-07-11',13500);
INSERT INTO employees VALUES(100, 'Russell', '2019-10-05', 13000);
INSERT INTO employees VALUES(100, 'Partners', '2018-12-01',14000);
INSERT INTO employees VALUES(200, 'Ross', '2019-06-11',13500);
INSERT INTO employees VALUES(200, 'Bell', '2019-05-25', 13000);
INSERT INTO employees VALUES(200, 'Part', '2018-08-11',14000);
COMMIT;
obclient> SELECT STDDEV_SAMP(salary) FROM employees;
+---------------------+
STDDEV_SAMP(salary)
+---------------------+
5506.194858355616
+---------------------+
1 row in set (0.01 sec)