Statistical functions are functions that are often used in database operations, also known as basic functions or set functions, and commonly used statistical functions as shown in table 4-6.
These functions are typically used in the SELECT clause as the result of the fields returned by the result dataset. The syntax for using functions in the SELECT clause of a SELECT statement is as follows:
SELECT function name (column name 1 or *), ... Function name (column name N)
From table name
Reminder: The object or argument of a function must be enclosed in parentheses. If the function requires more than one argument, you can separate the arguments with commas.
1, AVG ()
The AVG () function returns an arithmetic average of the column values. This function only applies to numeric columns. The syntax is as follows:
Example 4-26: The average wage of each department
The results of the operation are as follows:
2, COUNT ()
The count () function returns the number of data that is not a null value in the column that matches the selected expression. The syntax for the COUNT () function is as follows:
Example 4-27: Calculating the number of departments in an enterprise