VARIANCE
VARIANCE( expr )
Section titled “VARIANCE( expr )”- expr: This is the column or expression for which the variance is to be calculated. The `expr` must be a number type field.
Example
Section titled “Example”SELECT VARIANCE(salary) FROM employees;Output
Section titled “Output”VARIANCE(SALARY)---------------- 1875.25Explanation
Section titled “Explanation”In the example, the function VARIANCE() is used to compute the statistical variance of all salaries in the employees table. The variance quantifies the spread of the salary data. The higher the variance, the wider the range of salaries in the company.
VARIANCE( expression )
Section titled “VARIANCE( expression )”- expression: This is the numeric expression over which the variance will be calculated. It represents any valid expression that resolves to a number from which the variance needs to be derived. This can refer to a column of a table, or a mathematical expression involving numbers and column values.
Example
Section titled “Example”SELECT VARIANCE(Salary) AS SalaryVarianceFROM Employees;Output
Section titled “Output”SalaryVariance--------------5500.65Explanation
Section titled “Explanation”The example code calculates the variance of salaries for all employees in the ‘Employees’ table. The VARIANCE() function calculates the variance of a set of numbers. The variance measures how far each number in the set is from the mean (average) and thus from every other number in the set. Here it is used to understand the dispersion of employee salaries.