sum
sql>select sum(singles) total_singles from tablename
sql>select sum(singles) total_singles,sum(doubles) total_doubles,sum(triples) total_triples,sum(hr),total_hr
from tablename (输出多个列的和)
sql>select sum(singles) total_singles,sum(doubles) total_doubles,sum(triples) total_triples,sum(hr),total_hr
from tablename
where hits/ab>=300 (输出所有点数在300(包含300)以上的队员)
avg
avg将返回某一列的平均值
sql>select avg(so) avg_strike_outs from tablename
max
max将返回某一列的最大值
sql>select max(hits) from tablename
sql>select name from tablename where hits=max(hits)
min
min将会返回某一列的最小值
sql>select min(name) from tablename
sql>select mix(a),max(b) from tablename
variance方差
stddev标准差
日期和时间函数
sql>select * from project
add_months
sql>select a,b,c,d add_months from project
sysdate
将返回系统当前的日期和时间
sql>select distinct sysdate from project
数学函数
abs
将返回给定数字的绝对值
ceil和floor
ceil将返回与给定参数相等或比给定参数在的最小参数
floor则正好相反,将返回与给定参数相等或比给定参数小的最大整数
sql>select b,ceil(b) ceiling from numbers
sql>select a,floor(a) floor from numbers
cos,cosh,sin,sinh,tan,tanh
cos,sin,tan函数可以返回给定参数的三角函数值,默认的参数认定为弧度制,
sql>select a,cos(a) from numbers
解析:你可能认为cos(45)的返回值应该为0.707左右,而不应该是0.525,如果你想让他按照弧度制来计算,那么你需要将弧度制转换为角度制,由于360角度为2个弧度,所以,我们可以写成:
sql>select a,cos(a*0.01745329251994) from numbers
解析:这里的将角度转换成弧度后的数值,三角函数也可以像下面写的那样工作
sql>select a,cos(a*0.017453),cosh(a*0.017453) from numbers
sql>select a,sin(a*0.017453),sinh(a*0.017453) from numbers
sql>select a,tan(a*0.017453),tanh(a*0.017453) from numbers
exp
exp将返回以给定的参数为指数,以e为底数的冥值
sql>select a,exp(a) from numbers
ln and log
这是连个对数函数,ln返回给定参数的自然对数
sql>select a,ln(a) from numbers