MENU
GROUP BY Aggregate
COUNT([DISTINCT] expr) returns the number of values retrieved.MAX([DISTINCT] expr) returns the maximum value retrieved.
MIN([DISTINCT] expr) returns the minimum value retrieved.
SUM ([DISTINCT] expr) returns the sum of the values retrieved.
AVG([DISTINCT] expr) returns the average of the values retrieved. GROUP_CONCAT
([DISTINCT] expr) returns a string that is the concatenation of the retrieved values.
SELECT COUNT(*) FROM tbl; |
SELECT a FROM tbl GROUP BY a HAVING MAX(b)>9 |
SELECT GROUP_CONCAT(DISTINCT score SEPARATOR ‘ ‘) FROM class GROUP BY student |
BIT_AND(expr), BIT_OR(expr),and BIT_XOR (expr) perform bitwise operations on the values retrieved.STD(expr), STDDEV(expr), or STDDEV_POP (expr) returns the population standard deviation. STDDEV_SAMP(expr) returns the sample standard deviation. VARIANCE(expr) or VAR_POP(expr) returns the population standard variance. VAR_SAMP (expr) returns the sample variance.