函数名 | 函数解释 | 函数举例 | | | | | |
AVG() | 返回一组数值的平均值. | SELECT AVG(SALARY ) FROM BSEMPMS; | |
CORR(),CORRELATION() | 返回一对数值的关系系数. | SELECT CORRELATION(SALARY,BONUS) FROM BSEMPMS; | |
COUNT() | 返回一组行或值的个数. | SELECT COUNT(*) FROM BSEMPMS; | |
COVAR(),COVARIANCE() | 返回一对数值的协方差. | SELECT COVAR(SALARY,BONUS) FROM BSEMPMS; | |
MAX() | 返回一组数值中的最大值. | SELECT MAX(SALARY) FROM BSEMPMS; | |
MIN() | 返回一组数值中的最小值. | SELECT MIN(SALARY) FROM BSEMPMS; | |
STDDEV() | 返回一组数值的标准偏差. | SELECT STDDEV(SALARY) FROM BSEMPMS; | |
SUM() | 返回一组数据的和. | SELECT SUM(SALARY) FROM BSEMPMS; | |
VAR(),VARIANCE() | 返回一组数值的方差. | SELECT VARIANCE(SALARY) FROM BSEMPMS; | |
ABS(),ABSVAL() | 返回参数的绝对值. | SELECT ABS(-3.4) FROM BSEMPMS; | |
ACOS() | 返回参数的反余弦值. | SELECT ACOS(0.9) FROM BSEMPMS; | |
ASCII() | 返回整数参数最左边的字符的ASCII码. | SELECT ASCII('R') FROM BSEMPMS; | |
ASIN() | 返回用弧度表示的角度的参数的反正弦函数. | SELECT ASIN(0.9) FROM BSEMPMS; | |
ATAN() | 返回参数的反正切值,该参数用弧度表示的角度的参数. | SELECT ATAN(0.9) FROM BSEMPMS; | |
ATAN2() | 返回用弧度表示的角度的X和Y坐标的反正切值. | SELECT ATAN2(0.5,0.9) FROM BSEMPMS; | |
BIGINT() | 返回整型常量中的数字或字符串的64位整数表示. | SELECT BIGINT(EMP_NO) FROM BSEMPMS; | |
CEILING() OR CELL() | 返回比参数大或等于参数的最小的整数值. | SELECT CEILING(3.56) FROM BSEMPMS;SELECT CEIL(4.67) FROM BSEMPMS; | |
CHAR() | 返回日期时间型,字符串,整数,十进制或双精度浮点数的字符串表示. | SELECT CHAR(SALARY,',') FROM BSEMPMS; | |
CHR() | 返回具有由参数指定的ASCII码的字符. | SELECT CHAR(167) FROM BSEMPMS; | |
CONCAT() | 返回两个字符串的连接. | SELECT CONCAT(EMP_NO,EMP_NAM) FROM BSEMPMS; | |
YEAR() | 返回数值的年部分. | SELECT YEAR('2003/01/02') FROM BSEMPMS; | |
VARCHAR() | 返回字符串,日期型,图形串的可变长度的字符串表示. | SELECT VARCHAR(EMP_NAM,50) FROM BSEMPMS; | |
UCASE() OR UPPER() | 返回字符串的大写. | SELECT UCASE(EMP_NAM) FROM BSEMPMS;SELECT UPPER(EMP_NO) FROM BSEMPMS; | |
TRUNCATE() OR TRUNC() | 从表达式小数点右边的位置开始截断并返回该数值. | SELECT TRUNCATE(345.6789,2) FROM BSEMPMS; | |
TIME() | 返回一个数值中的时间. | SELECT TIME('2001-03-19.12.30.123456') FROM BSEMPMS; | |
SUBSTR(EXP1,EXP2) | 返回EXP1串自EXP2处开始的子串. | SELECT SUBSTR('CDNJFDJFJD',5) FROM BSEMPMS;SELECT SUBSTR('CDNJFDJFJD',5,2) FROM BSEMPMS; | |
SQRT() | 返回该参数的平方根. | SELECT SQRT(36) FROM BSEMPMS; | |
SPACE() | 返回由参数指定的长度,包含空格在内的字符串. | SELECT SPACE(10) FROM BSEMPMS; | |
SECOND() | 返回一个数值的秒部分. | SELECT SECOND('18:34:32') FROM BSEMPMS; | |
RTRIM() | 删除字符串尾部的空格. | SELECT RTRIM('COMMENT') FROM BSEMPMS; | |
ROUND(EXP1,EXP2) | 返回EXP1小数点右边的第EXP2位置处开始的四舍五入值. | SELECT ROUND(2345.6789,2) FROM BSEMPMS | |
REPLACE(EXP1,EXP2,EXP3) | 用EXP3替代EXP1中所有的EXP2 | SELECT CHAR(REPLACE('ROMANDD','NDD','CCB'),10) FROM BSEMPMS; | |
REPEAT(EXP1,EXP2) | 返回EXP1重复EXP2次后的字符串. | SELECT CHAR(REPEAT('REPEAT',3),21) FROM BSEMPMS; | |
REAL() | 返回一个数值的单精度浮点数表示. | SELECT REAL(10) FROM BSEMPMS; | |
RAND() | 返回0和1之间的随机浮点数. | SELECT RAND() FROM BSEMPMS; | |
POWER(EXP1,EXP2) | 返回EXP1的EXP2次幂. | SELECT POWER(2,5) FROM BSEMPMS; | |
POSSTR(EXP1,EXP2) | 返回EXP2在EXP1中的位置. | SELECT ('ABCDEFGH','D') FROM BSEMPMS; | |
NULLIF(EXP1,EXP2) | 如果EXP1=EXP2,则为NULL,否则为EXP1 | | |
NODENUMBER() | 返回行的分区号. | SELECT NODENUMBER(EMP_NO) FROM BSEMPMS; | |
MONTH() | 返回一个数值的月部分. | SELECT MONTH('2003/10/20') FROM BSEMPMS; | |
MOD(EXP1,EXP2) | 返回EXP1除以EXP2的余数. | SELECT MOD(20,8) FROM BSEMPMS; | |
MINUTE() | 返回一个数值的分钟部分. | SELECT MINUTE('18:34:23') FROM BSEMPMS; | |
LTRIM() | 删除字符串前面的空格. | SELECT LTRIM('CDDD') FROM BSEMPMS; | |
HOUR() | 返回一个数值的小时部分. | SELECT HOUR('18:34:23') FROM BSEMPMS; | |
DOUBLE() | 如果参数是一个数字表达式,返回与其相对应的浮点数,如果参数是字符串表达式,则返回该数的字符串表达式. | SELECT DOUBLE('5678') FROM BSEMPMS; | |
EXP() | 返回参数的指数函数. | SELECT EXP(2) FROM BSEMPMS; | |
FLOAT() | 返回一个数的浮点表示. | SELECT FLOAT(789) FROM BSEMPMS; | |
FLOOR() | 返回小于或等于参数的最大整数. | SELECT FLOOR(88.93) FROM BSEMPMS; | |
HEX() | 返回一个表示为字符串的值的16进制表示. | SELECT HEX(16) FROM BSEMPMS; |