mysql语句判断某一字段是否为空

在mysql语句中,null的默认值为‘ ’(空字符串)。

所以,

判断某一字段为空时:

字段名 is not null and length(字段名)=0;

判断某一字段不为空时:

字段名 is not null and length(字段)>0;

猜你喜欢

转载自blog.csdn.net/Exaggeration08/article/details/83017275