MySQL 函数

Aggregate Functions

COUNT()

" 返回表的记录数
SELECT COUNT(*) FROM table_name

" 返回 column_name 值的数量,NULL 值不会被统计
SELECT COUNT(column_name) FROM table_name

" 返回指定列的不同(独特)值的个数
SELECT COUNT(DISTINCT column_name) FROM table_name

String Functions

LENGTH()

返回字符串的长度

SELECT LENGTH(column_name) FROM table_name