avg()平均数 SELECT AVG(column_name) FROM table_name
count()表中的记录数 SELECT COUNT(*) FROM table_name
first()指定字段中第一个记录的值 SELECT FIRST(column_name) FROM table_name
last()指定字段中最后一个记录的值 SELECT LAST(column_name) FROM table_name
max()最大值 SELECT MAX(column_name) FROM table_name
min()最小值 SELECT MIN(column_name) FROM table_name
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
Having 因为WHERE关键字无法与合计函数一起使用,所以引进了Having子句
--> SELECT column_name, aggregate_function(column_name)
FROM table_name
WHERE column_name operator value
GROUP BY column_name
HAVING aggregate_function(column_name) operator value
UCASE() 把函数的字段的值改为大写 SELECT UCASE(column_name) FROM table_name
LCASE() 把函数的字段的值改为小写 SELECT LCASE(column_name) FROM table_name
MID() 从文本字段中提取字符 SELECT MID(column_name, start[,length]) FROM table_name
column_name-->必需,要提取字符的字段
start-->必需,规定开始位置(起始值是1).
length-->可选,要返回的字符数。如果省略,则MID()函数返回剩余文本
LEN()文本字段中值的长度 SELECT LEN(column_name) FROM table_name
ROUND() 把数值字段舍入为指定的小数位数 SELECT ROUND(column_name, decimals) FROM table_name
column_name-->必需,要舍入的字段
decimals-->必需,规定要返回的小数位数
NOW() 当前的日期和时间 SELECT NOW() FROM table_name
FORMAT() 对字段进行格式化 SELECT FROMAT(column_name, format) FROM table_name
例:SELECT ProductName, UnitPrice, FORMAT(NOW(),'YYYY-MM-DD') as PerDate FROM Products