MySQL 常用函数进行简单的分类,大概包括数值型函数、字符串型函数、日期时间函数、聚合函数等。
参考:http://c.biancheng.net/mysql/function/
#select sname as "姓名", length(sname) as "姓名的字数" from stu; #select sid from stu where age>20; SELECT CONCAT(‘hello‘,‘world‘); SELECT CONCAT_WS(‘-‘,‘hello‘,‘world‘); SELECT LEFT(‘right‘,3); SELECT TRIM(‘ Hello world ‘); SELECT SUBSTRING(‘hello‘,2); SELECT CEIL(2.4), FLOOR(2.2),ROUND(2.6); SELECT ROUND(2.123673,4),TRUNCATE(2.2342341,4); SELECT NOW() SELECT SYSDATE() SELECT CURRENT_DATE(); SELECT CURRENT_DATE(); SELECT CURRENT_TIMESTAMP();