具体都可以见mysql 操作手册: dev.mysql.com/doc/refman/…
1. Numeric Functions(数值函数)
2. String Functions(字符串函数)
3. Date Function (日期函数)
select year(now) 提取当前时间的年份
4. Formates Dates and Times (格式化日期时间)
select time_format(now(),%,%)
5. Caculating Dates and Times(计算日期时间)
增加/减少: Date_add/Date_sub
返回两个日期的间隔数:
time_to_sec(now):反映从0点开始消逝的秒数
6. The IFNULL and COALESCE Functions
- IFNULL: 用‘’代替空值的情况
- COALESCE:返回括号中的第一个非空值
🌰:
7. The IF Functions
也可以写2个select 再用union 合并
8. The CASE Operator
case
when...
when...
else
end