Switch to: V11V10V9V8V7V6V5
Computing Sum of Field Values

SUM() function computes the sum of all field values. Therefore the field should have the numerical data-type. The result returning by this function has the same data-type as the field, but the result accuracy can be higher.

What are the total plan and total real sales volume in the company?

	SELECT SUM (quota), SUM (sales)
	FROM salesreps 
Computing Average of Field Values.

AVG function computes the average of all field values. The field should have the numerical type. As AVG function first sums up all values contained in the field and then divide the sum on the number of these values, the result has double type.

Compute the average goods' price from ACI producer.

	SELECT AVG (price)
	FROM products
	WHERE mfr_id = 'ACI' 
Computing Extremes of Field Values

MIN() and MAX() functions allow to find correspondingly the less and the most values in the field.

The field can contain numerical or string values or date/time values. Result has the same data-type as the field itself.

	SELECT MIN (quota), MAX (quota)
	FROM salesreps

Comparison of numbers, records, dates, time intervals occurs according to the standard rules.

Counting Values of Field.

COUNT(*) function counts the number of records in the resulting table.

Data-type of the field can be of any kind. This function always returns the fixed-point number irrespective of data-type of the field.

How many clients are there in the company?

	SELECT COUNT ( * )
	FROM customers

COUNT(expr) function counts the value number in the field.

How many clients are there in the company?

	SELECT COUNT (cust_num)
	FROM customers
Computing BIT Functions for Values of Field.

BIT_AND( expr ) Calculates bitwise AND for values of group. Returns value with all bits 1 if there is no records in the group.

BIT_OR( expr ) Calculates bitwise OR for values of group. Returns zero (0) if there is no records in the group.

BIT_XOR( expr ) Calculates bitwise OR for values of group. Returns zero (0) if there is no records in the group.