mysql 的 case when then 用法 和null 的判断

case when有两种写法,参见:
http://www.malaoshi.top/show_1EFhQqz16Lh.html

在判断null时只能用下面这种方法

select id ,(case   when sex= ''  then 'bbbbb'
                      when sex is null then 'aaaaa' 
                             else sex end  ) as sex FROM aa;

原文出处:/show_1EFhQtfW4oo.html