MYSQL 函数 //AVG() 平均值函数 SELECT AVG(column_name) FROM table_name //COUNT() 查询匹配行数量 SELECT COUNT(column_name) FROM table_name //FIRST() 返回查询到的第一个 SELECT FIRST(column_name) FROM table_name //LAST() //MAX() 一列中最大值 SELECT MAX(column_name) FROM table_name //MIN() //SUM() 查询列值的总和 SELECT SUM(column_name) FROM table_name //GROUP BY 分组 SELECT column_name, aggregate_function(column_name) FROM table_name WHERE column_name operator value GROUP BY column_name... //大写 SELECT UCASE(column_name) FROM table_name //小写 SELECT LCASE(column_name) FROM table_name //MID() 提取列中的文本字段,默认从1开始,length长度 SELECT MID(column_name,start[,length]) FROM table_name //LEN() 返回文本字段值的长度 SELECT LEN(column_name) FROM table_name //ROUND() 函数舍入指定的小数位数 SELECT ROUND(column_name,decimals) FROM table_name //NOW() 返回当前的日期和时间 SELECT NOW() FROM table_name //FORMAT() 对字段进行格式化 SELECT FORMAT(column_name,format) FROM table_name