Informix aggregation query

The Informix database supports a series of aggregation functions for aggregate queries. Here are some commonly used aggregation functions and their examples: 1. COUNT function: used to count the number of rows in a column or all columns. Example 1: Total number of records in the statistical table SELECT COUNT (*) from table name; Example 2: Counting the number of non null values in a column SELECT COUNT (column name) from table name; 2. SUM function: used to calculate the sum of a column. Example: Calculating the Sum of a Column SELECT SUM (column name) from table name; 3. AVG function: used to calculate the average value of a column. Example: Calculate the average value of a column SELECT AVG (column name) from table name; 4. MIN function: used to find the minimum value of a column. Example: Finding the minimum value of a column SELECT MIN (column name) from table name; 5. MAX function: used to find the maximum value of a column. Example: Finding the maximum value of a column SELECT MAX (column name) from table name; 6. GROUP BY clause: used to group results based on one or more columns and perform aggregation functions on each group. Example: Counting the number of employees in each department SELECT department, COUNT (*) from employee table GROUP BY department; 7. HAVING clause: used to filter the GROUP BY results. Example: Identify departments with more than 5 employees SELECT department, COUNT (*) from employee table GROUP BY department HAVING COUNT (*)>5; When it is necessary to explain, please replace the table structure and sample data used in the above examples according to the specific situation.