哈希空间

mysql where条件查询

where 查询条件

查找 姓名 name 等于 Jack 的记录

select * from `student` where name='Jack'

结果:

id name birthday height
1 Jack 1990-01-01 180

几种查询例子:

查找 身高大于等于 170 的记录

select * from `student` where height >=170

and 查询

查找 姓名 name 等于 Jack 身高大于等于 170 的记录

select * from `student` where name='Jack' and height >=170

or 查询

查找 姓名 name 等于 Jack 身高大于等于 170 的记录

select * from `student` where name='Jack' or height >=170

null 记录查询

查找 手机号 mobile 为空 的记录

select * from `student` where mobile is null

多条件查询

查询 身高大于等于 170 或 ( 姓名等于 Jack 且 生日在1980年1月1日之后)

select * from studeng where (name='Jack' and birthday>='1980-01-01') or height>=170

这里使用了 括号 来表示优先级。

本文 最佳观看地址:https://www.hashspace.cn/mysql-where-tiaojianchaxun.html 阅读 479

打开 哈希空间 微信小程序中查看更佳