poloyy

测试必备的Mysql常用sql语句系列

https://www.cnblogs.com/poloyy/category/1683347.html

 

前言

  • is null是一个关键字来的,用于判断字段的值是否为空值(NULL)
  • 空值 ≠ 0,也 ≠ 空字符串"" 

 

语法格式

两种写法:

  1. 字段值为空
  2. 字段值不为空
IS NULL
IS NOT NULL

 

确定表里面的数据,方便后面的栗子做对比

 

空值查询的栗子

查询sex字段为空的记录

select * from yyTest where sex is null;

查询sex字段不为空的记录

select * from yyTest where sex is not null;

知识点

  • is null 是一个整体,不能用  = null 替代
  • is not null 同理,不能用  != null  或  <>  替代

 

分类:

技术点:

相关文章:

  • 2020-05-14
  • 2021-11-05
  • 2021-10-02
  • 2021-11-12
  • 2021-11-12
  • 2021-11-06
  • 2020-05-11
  • 2021-06-05
猜你喜欢
  • 2021-12-14
  • 2021-11-12
  • 2021-11-23
  • 2021-04-05
  • 2021-08-07
  • 2020-05-11
相关资源
相似解决方案