Advantage SQL Engine
expr = column name or SQL expression
AVG( expr ) |
Calculates the average of a set of values. |
COUNT( [ ALL | DISTINCT ] expr ) |
Returns the number of non-NULL column items that satisfy a query’s search condition. The ALL keyword is the default action and the DISTINCT keyword returns the number of non-NULL and distinct column items. |
COUNT(*) |
Returns the number of rows that satisfy a query’s search condition. |
MAX( expr ) |
Returns the maximum of a set of values. |
MIN( expr ) |
Returns the minimum of a set of values. |
SUM( expr ) |
Totals the values in a set of numeric values. |
Note NULL columns are ignored; The DISTINCT and ALL keywords are only supported with the COUNT aggregate.
Examples
SELECT AVG(quota), AVG(sales) FROM salesinfo
SELECT AVG(100 * (sales/quota)) FROM salesinfo
SELECT COUNT(empid) FROM employees
SELECT COUNT(ordernum) FROM orders WHERE amount > 1000
SELECT COUNT(*) FROM orders WHERE amount > 1000
SELECT MIN(quota), MAX(quota) FROM salesinfo
SELECT MAX(100 * (sales/quota)) FROM salesinfo
SELECT MIN(100 * (sales/quota)) FROM salesinfo
SELECT SUM(quota), SUM(sales) FROM salesinfo
SELECT SUM(sales - quota) FROM salesinfo