IF
IF(expr,v1,v2)
若expr是TRUE(即:expr <> 0 and expr <> NULL),则该函数返回值为v1,否则返回值为v2
IFNULL
IFNULL(v1,v2)
判断v1、v2是否为空
两个都不为空时返回v1
v1为空返回v2
CASE
case exer when v1 then r1 when v2 then r2 else r3 end
当expe满足v1就返回r1,若满足v2就但会r2,否则返回r3
case when exer1 then r1 when exer2 then r2 else r3 end
但exer1为true就返回r1,当expr2为true就返回r2,否则就返回r3