AVG Function

It is an aggregate function that returns the average of the resultant column values in decimal. It also allows two optional parameters ALL and DISTINCT, where ALL is the default parameter when any of these are not passed.

  • ALL: This is the default parameter. If this parameter is used then duplicate values are also considered for computing average.
  • DISTINCT: If this parameter is used then duplicate values are not considered for computing average.

MariaDB AVG Function

MariaDB is an open-source relational database management system that is a of MySQL and is based on SQL(Structured query language). It is an improved version of MySQL and has various features, security, and performance when compared to MySQL.

The MariaDB AVG function is used to calculate the average of values present in the column. The average returned is a decimal value. It can also remove duplicate values before computing the average.

Syntax:

AVG ( [ALL | DISTINCT] expr )

Similar Reads

AVG Function

It is an aggregate function that returns the average of the resultant column values in decimal. It also allows two optional parameters ALL and DISTINCT, where ALL is the default parameter when any of these are not passed....

Example of AVG Function

For better understanding of AVG Functions we need a table on which we will perform some operations. So we will create Table called employees which consist of employee_id, name, salary,and department_id as Columns....

Conclusion

The AVG Function is very useful for computing averages and you can use it to get the average of distinct values of the required column. You use the average function along with the SELECT, FROM, WHERE queries without any problem. The text under parenthesis is the name of the column where the average will be displayed. This works for numeric values so don’t use it for column having other than numeric data type. The AVG Function is a powerful function for calculating the average of a set of values which is important for data analysis and exploration....

Contact Us