The SQL AVG function computes the average of the values for the column( or expression) specified as an argument.
We should not give AVG function on CHAR arguments. This function operates only on numeric arguments.
The following example calculates the average salary of each department:
SELECT WORKDEPT, AVG(SALARY) FROM DSN81010.EMP GROUP BY WORKDEPT;
The AVG function is the preferred method of calculating the average of a group of values.
Although an average, in theory, is nothing more than a sum divided by a count, DB2 may not return equivalent values for AVG(COL_NAME) and SUM(COL_NAME)/COUNT(*).
The reason is that the COUNT function will count all rows regardless of value, whereas SUM ignores nulls.
How to Count and Print Blank Spaces in Python
Two Python methods that show you how to count blank spaces in a text file
The Easy Way to Get Duplicate Records: Top SQL Query
Here is an SQL query explained to get duplicate records from a table
How to write Stored Procedure in DB2: Unique Ideas
The unique tips you must know before you write a high-performing stored procedure in DB2