COALESCE函数
COALESCE函数会依次检查输入的参数,返回第一个不是NULL的参数,只有当传入COALESCE函数的所有的参数都是NULL的时候,函数才会返回NULL
COALESCE ( expression1,expression2..... )
CASE WHEN
类似python 中的where 函数 : 如果 怎么了 就怎样
“`
第一种
case sex
when ‘1’ then ‘男’
when ‘2’ then ‘女’
else ‘其他’ end
第二种
case when sex = ‘1’ then ‘男’
when sex = ‘2’ then ‘女’
else ‘其他’ end
可以跟在SELECT 之后,注意必须使用END 结尾
待补充