#第七章 单行函数
SELECT CONCAT(‘hello’,‘world’)
FROM DUAL;
#1.数值函数
SELECT ABS(-123),ABS(32),SIGN(-23),SIGN(43),PI(),CEIL(32.32),CEILING(-43.23),FLOOR(32.32),
FLOOR(-43.23),MOD(12,5),12 MOD 5,12%5
FROM DUAL;
SELEC TRAND(1),RAND(1),ROUND(12.3),ROUND(12.5),ROUND(12.33,0),ROUND(12.33,1),ROUND(12.3,-1),ROUND(12.5,-1),ROUND(15.5,-1)
#单行函数可以嵌套
SELECT TRUNCATE (ROUND(123.456,2),0)
#角度与弧度互换函数
SELECT RADIANS(30),RADIANS(60),RADIANS(90),DEGREES(2*PI()),DEGREES(RADIANS(90)),SIN(RADIANS(30)),DEGREES(ASIN(1))
FROM DUAL;
SELECT SIN(RADIANS(30)),DEGREES(ASIN(1)),TAN(RADIANS(45)),DEGREES(ATAN(1)),DEGREES(ATAN(1,1))
FROM DUAL;
#指数和对数函数
SELECT POW(2,5),POWER(2,4),EXP(2)
SELECT LN(EXP(2))
SELECT LN(EXP(3)),LOG10(10),LOG10(4),LOG2(4)
SELECT BIN(10),HEX(10)
FROM DUAL;
SELECT ASCII(‘Abc’),ASCII(‘abc’),FIELD(‘mm’,‘hello’,‘msm’,‘amma’),FIND_IN_SET(‘mm’,‘hello,mm,amma’);
SELECT CONCAT(‘a’,‘b’,‘ll’,‘j’);
#加密与解密函数
SELECT PASSWORD(‘songwenli’),MD5(‘songwenli’),SHA(‘songwenli’)
#信息函数
SELECT VERSION(),CONNECTION_ID(),DATABASE(),USER(),COLLATION(‘aaa’)