Java OpenResty Spring Spring Boot MySQL Redis MongoDB PostgreSQL Linux Android Nginx 面试 小程序 Arthas JVM AQS juc Kubernetes Docker 诊断工具


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,需要结合()使用
阅读 1296 · 发布于 2019-04-06

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb

扫描下方二维码关注公众号和小程序↓↓↓

扫描二维码关注我
昵称:
随便看看 换一批