SELECT ABS(-1); //1
SELECT AVG(score) FROM sc;
SELECT CEIL(1.5);//2
SELECT CEILING(1.5);//2
SELECT FLOOR(1.5); //1
SELECT EXP(3); //
SELECT GREATEST(3, 12, 34, 8, 25); // 34
SELECT LEAST(3, 12, 34, 8, 25);//3
8. LN 返回数字的自然对数
SELECT LN(2);
SELECT LOG(20.085536923188);
SELECT MAX(score) FROM sc;
SELECT MIN(score) FROM sc;
SELECT POW(2,3);
SELECT POWER(2,3);
SELECT RAND();
SELECT ROUND(1.23456); // 1
SELECT SIGN(-10); //-1
SELECT SQRT(25);
SELECT SUM(score) FROM sc;
SELECT TRUNCATE(1.23456,3);// 1.234
SELECT ASCII('AB');
SELECT LENGTH('1234'); // 4
SELECT CONCAT('hel','llo');// hello
SELECT FIND_IN_SET("c", "a,b,c,d,e"); // 3
SELECT FORMAT(250500.5634, 2); // 250,500.56
SELECT INSERT("google.com", 1, 6, "runnob");// runnob.com
SELECT LOCATE('st','myteststring'); // 5
SELECT LOWER('RUNOOB'); // runnoob
SELECT UCASE('runoob'); // RUNOOB
SELECT TRIM(' RUNOOB ');// RUNOOB
SELECT LTRIM(' RUNOOB '); // RUNOOB
SELECT RTRIM(' RUNOOB ');// RUNOOB
SELECT SUBSTR("RUNOOB", 2, 3);// UNO
SELECT SUBSTRING("RUNOOB", 2, 3);// UNO
SELECT POSITION('b' in 'abc');// 2
SELECT REPEAT('runoob',3);//runoobrunoobrunoob
SELECT REVERSE('abc');// cba
SELECT STRCMP("runoob", "runoob");
SELECT CURDATE();
SELECT CURRENT_DATE();
SELECT CURRENT_TIME();
SELECT CURRENT_TIMESTAMP();
SELECT ADDDATE("2017-06-15", INTERVAL 10 DAY);//2017-06-25
SELECT ADDTIME('2011-11-11 11:11:11', 5);// 2011-11-11 11:11:16
SELECT DATE("2017-06-15 11:11:16");//2017-06-15
SELECT DAY("2017-06-15"); //2017-06
SELECT DATEDIFF('2001-01-01','2001-02-02'); // 30
SELECT DATE_FORMAT('2011.11.11 11:11:11','%Y-%m-%d %r');// 2011-11-11 11:11:11 AM
SELECT DAYNAME('2011-11-11 11:11:11');
SELECT DAYOFMONTH('2011-11-11 11:11:11');
12、DAYOFWEEK(d)日期 d 今天是星期几,1 星期日,2 星期一,以此类推
SELECT DAYOFWEEK('2011-11-11 11:11:11');
SELECT DAYOFYEAR('2011-11-11 11:11:11');
SELECT EXTRACT(MINUTE FROM '2011-12-13 14:15:16');
SELECT UNIX_TIMESTAMP('2019-2-19');
SELECT IF(1>0,'yes','no');// yes
SELECT CONV(13,10,2);//1101
SELECT CURRENT_USER();
SELECT DATABASE();
SELECT VERSION();
(case when main.ticket_status = 61 then 2 when main.ticket_status >= 60 then 1 else 0 end) as survey_receive_type