Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Aggregate Functions

AVG

Returns the average (mean) value. If no rows are selected, the result is NULL. Aggregates are only allowed in select statements. The returned value is of the same data type as the parameter.

...

SELECT  AVG(Salary)  FROM  Employee

Back to top

COUNT

Returns the count of all rows, or of non-null values.

...

SELECT COUNT(*) FROM Employee
GO
SELECT COUNT(ID) FROM Employee
GO

Back to top

MAX

Returns the highest value.

...

SELECT MAX(Salary) FROM Employee

Back to top

MIN

Returns the lowest value.

...

SELECT MIN(Salary) FROM Employee

Back to top

SUM

Returns the sum of all values.

...

SELECT SUM(Salary) FROM Employee

Back to top

GROUP_CONCAT

Concatenates strings with a separator. The default separator is a ',' (without space). This method returns a string. If no rows are selected, the result is NULL. Aggregates are only allowed in select statements.

...

SELECT GROUP_CONCAT(First_name ORDER BY E_id SEPARATOR ';') FROM Employee

Back to top

SELECTIVITY

Estimates the selectivity (0-100) of a value. The value is defined as (100 * distinctCount / rowCount). The selectivity of 0 rows is 0 (unknown). Up to 10000 values are kept in memory. Aggregates are only allowed in select statements.
 

...

SELECT SELECTIVITY(First_name), SELECTIVITY(City) FROM Employee WHERE ROWNUM() < 2

Back to top

BOOL_AND, BOOL_OR

BOOL_AND returns true if all expressions are true. BOOL_OR returns true if any expression is true.

...

SELECT BOOL_OR(Name LIKE 'W%') FROM Employee

Back to top

STDDEV_POP, STDDEV_SAMP

STDDEV_POP returns the population standard deviation while STDDEV_SAMP returns the sample standard deviation.

...

SELECT STDDEV_SAMP(ID) FROM Employee

Back to top

VAR_POP, VAR_SAMP

VAR_POP returns the population variance while VAR_SAMP returns the sample variance.

...