MYSQL 判断为空和空字符串

2022-03-17 19:02:03

MYSQL 中,进行空值的判断:

判断某个字段是否为空

isnull 判断是否为空:
只有当字段为null时,isnull()返回1,空串和有数据都为0
select * from user where ISNULL(name)=1;
is not null
select * from user where name is not null;

判断某个字段是否为空串

select goods_id,item_code from goods_info where LENGTH(trim(item_code))>0

  • 作者:小小鱼er
  • 原文链接:https://blog.csdn.net/yuxuan89814/article/details/111625510
    更新时间:2022-03-17 19:02:03