0 votes
in MariaDB by
What is an aggregate function? How many types of aggregate functions in MariaDB?

1 Answer

0 votes
by
In relational database management system, aggregate functions are the functions where the values of multiple rows are grouped together as input on certain criteria and provide a single value of more significant meaning such as a list, set, etc.

Following is a list of aggregate function in MariaDB:

MariaDB COUNT Function: In MariaDB database, COUNT function is used to return the count of an expression.

Syntax:

SELECT COUNT(aggregate_expression)    

FROM tables    

[WHERE conditions];     

The COUNT () Function counts only NOTNULL values.

MariaDB SUM Function: MariaDB SUM function is used to return the summed value of an expression.

Syntax:

SELECT SUM(aggregate_expression)    

FROM tables    

[WHERE conditions];     

MariaDB MIN Function: MariaDB MIN () function is used to retrieve the minimum value of the expression.

Syntax:

SELECT MIN(aggregate_expression)    

FROM tables    

[WHERE conditions];     

MariaDB MAX Function: MariaDB MAX () function is used to retrieve the maximum value of the expression.

Syntax:

SELECT MAX(aggregate_expression)    

FROM tables    

[WHERE conditions];     

MariaDB AVG Function: MariaDB AVG() function is used to retrieve the average value of an expression.

Syntax:

SELECT AVG(aggregate_expression)    

FROM tables    

[WHERE conditions];     

Or

SELECT expression1, expression2, ... expression_n,    

AVG(aggregate_expression)    

FROM tables    

[WHERE conditions]    

GROUP BY expression1, expression2, ... expression_n;     

MariaDB BIT_AND Function: Returns the bitwise AND of all bits in exp.

Syntax:

BIT_AND (exp)  

MariaDB BIT_OR: Returns the bitwise OR of all bits in exp.

Syntax:

BIT_OR (exp)  

MariaDB BIT_XOR: Returns the bitwise XOR of all bits in exp.

Syntax:

BIT_XOR (exp)
...