UnityJDBC - Aggregate Functions

Aggregate functions operate on sets of values and return a single value.

Summary

Function Syntax Description
AVG AVG(expr) Returns the average of expr.
AVG Returns the average of expr ignoring duplicates.
BIT_AND BIT_AND(expr) Returns the bitwise AND of all bits in expr.
BIT_OR BIT_OR(expr) Returns the bitwise OR of all bits in expr.
BIT_XOR BIT_XOR(expr) Returns the bitwise XOR of all bits in expr.
COUNT COUNT(expr) Returns a count of the number of non-NULL values of expr.
COUNT DISTINCT Returns a count of the number of rows with no duplicates.
COUNT(*) COUNT(*) Returns a count of the number of rows.
GROUP_CONCAT GROUP_CONCAT(expr) Produces a string by concatenating all values of expr.
MAX MAX(expr) Returns the maximum value of expr.
MEDIAN MEDIAN(expr) Returns the maximum value of expr.
MIN MIN(expr) Returns the minimum value of expr.
SUM SUM(expr) Returns the sum of expr.

Detailed Function Descriptions

AVG

Syntax: AVG(expr)

Returns the average of expr. Returns NULL if there were no matching rows.

SQL Server Access Oracle PostgreSQL MySQL Sybase HSQLDB

AVG

Syntax:

Returns the average of expr ignoring duplicates. Returns NULL if there were no matching rows.

SQL Server Access Oracle PostgreSQL MySQL Sybase HSQLDB

BIT_AND

Syntax: BIT_AND(expr)

Returns the bitwise AND of all bits in expr.

SQL Server Access Oracle PostgreSQL MySQL Sybase HSQLDB

BIT_OR

Syntax: BIT_OR(expr)

Returns the bitwise OR of all bits in expr.

SQL Server Access Oracle PostgreSQL MySQL Sybase HSQLDB

BIT_XOR

Syntax: BIT_XOR(expr)

Returns the bitwise XOR of all bits in expr.

SQL Server Access Oracle PostgreSQL MySQL Sybase HSQLDB

COUNT

Syntax: COUNT(expr)

Returns a count of the number of non-NULL values of expr. Returns 0 if there were no matching rows.

SQL Server Access Oracle PostgreSQL MySQL Sybase HSQLDB

COUNT DISTINCT

Syntax:

Returns a count of the number of non-NULL values of expr with no duplicates.

SQL Server Access Oracle PostgreSQL MySQL Sybase HSQLDB

COUNT(*)

Syntax: COUNT(*)

Returns a count of the number of rows retrieved, whether or not they contain NULL values.

SQL Server Access Oracle PostgreSQL MySQL Sybase HSQLDB

GROUP_CONCAT

Syntax: GROUP_CONCAT(expr)

Grouping function that concatenates to form a single string all elements in the group. A comma is used as a separator.

SQL Server Access Oracle PostgreSQL MySQL Sybase HSQLDB

MAX

Syntax: MAX(expr)

Returns the maximum value of expr. Returns NULL if there were no matching rows.

SQL Server Access Oracle PostgreSQL MySQL Sybase HSQLDB

MEDIAN

Syntax: MEDIAN(expr)

Returns the maximum value of expr.

SQL Server Access Oracle PostgreSQL MySQL Sybase HSQLDB

MIN

Syntax: MIN(expr)

Returns the minimum value of expr. Returns NULL if there were no matching rows.

SQL Server Access Oracle PostgreSQL MySQL Sybase HSQLDB

SUM

Syntax: SUM(expr)

Returns the sum of expr. Returns NULL if there were no matching rows.

SQL Server Access Oracle PostgreSQL MySQL Sybase HSQLDB