MySQL 条件查询
MySQL 大约 490 字where 子句
select * from 表名 where 条件;
比较运算符
等于=
大于>
大于等于>=
小于<
小于等于<=
不等于!=或<>
逻辑运算符
and
or
not
模糊查询
like
%表示任意多个任意字符
_表示一个任意字符
范围查询
in表示在一个非连续的范围内
select * from user where home in ('魏','蜀');
between ... and ...表示在一个连续的范围内 ,>= and <=
select * from user where age between 26 and 40;
空判断
注意:null与''是不同的
判空is null
select * from user where home is null;
判非空is not null
select * from user where home is not null;
优先级
小括号,not,比较运算符,逻辑运算符
and比or先运算,如果同时出现并希望先算or,需要结合()使用
阅读 780 · 发布于 2019-04-06
————        END        ————
Give me a Star, Thanks:)
https://github.com/fendoudebb扫描下方二维码关注公众号和小程序↓↓↓

昵称:
随便看看
换一批
-
Java jstat 监控远程服务阅读 722
-
Spring 事务失效的几种场景阅读 405
-
Golang 在 Windows 上编译 Linux 版本阅读 2209
-
JMeter 使用 Response Assertion 自定义错误信息阅读 808
-
Golang 创建模块阅读 586
-
VisualVM 中的 OQL 语句查询阅读 972
-
Prometheus+Grafana+mysqld_exporter 监控 MySQL阅读 246
-
AndroidStudio non-zero value 1 错误阅读 762
-
Spring Boot 自动配置原理阅读 472
-
Nginx 负载均衡 WebSocket 请求阅读 913