- where + or查询公司牛人马云和马化腾的数据, and同理
select * from cattle_user where uname = '马云' or uname = '马化腾';
![](https://i-blog.csdnimg.cn/blog_migrate/0bc7ade88092d82ab5a770c019b99788.png)
- where + binary关键字, 查询英文名为jackma的数据, 并区分大小写
select * from cattle_user where uname_en = 'jackma'; -- 发现出现两条数据, JACKMA和jackma
-- 区分大小写
select * from cattle_user where binary uname_en = 'jackma';
- **where + like模糊查询 **
-- 查询姓名中带马的数据
select * from cattle_user where uname like '%马%';
-- 查询姓名中第二个字是马的数据, %指任意多个字符
select * from cattle_user where uname like '_马%'
- 判断为空非空
-- 空
select * from <表名> where <字段> is null
-- 非空
select * from <表名> where <字段> is not null