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扫描下方二维码关注公众号和小程序↓↓↓
昵称:
随便看看
换一批
-
不安装 redis-server 下连接 redis阅读 3195
-
PostgreSQL 时间戳转毫秒值并去除小数位阅读 6157
-
Java 并发的基石 LockSupport阅读 1534
-
JavaFX TextArea 按 Enter 键发送阅读 2037
-
使用 jsDelivr 解决 GitHub 资源下载慢的问题阅读 1134
-
Go 数字转字符串阅读 1494
-
IDEA 调试 Java 多线程代码阅读 1710
-
Go 解决 HTTP 请求跨域问题阅读 2586
-
HTML 中 script 标签中的 async 和 defer 的区别阅读 1693
-
Nginx 配置之 worker_processes阅读 4705