开发者社区 问答 正文

mysql where条件中字段=null为什么查不到数据

mysql> select * from books;
+------+--------+------+
| name | author | jb   |
+------+--------+------+
| lkj  | NULL   | NULL |
+------+--------+------+
1 row in set (0.02 sec)

mysql> select * from books where jb=null;
Empty set (0.02 sec)

展开
收起
道月芬1 2021-10-14 15:05:12 2650 分享 版权
1 条回答
写回答
取消 提交回答
  • 为空有几种 第一 ‘’ 这种空 这样的’’ 得用 select * from table where name=’’ 这样查询 第二种 数据库里面是NULL 这样的就用 select * from table where name is null 如果你还没有查询出来 你就先查看一下你的数据是否有NULL 或者NUll这样的 这样的话可能查询有误

    2021-10-14 17:01:07
    赞同 展开评论