MySQL where条件

where条件查询的语法格式:

select * from 表名 where 条件

比较运算符查询:

查询编号大于8的学生: select * from students where id > 8;
查询编号小于等于4的学生: select * from students where id <= 4;
查询没被删除的学生: select * from students where delete=0

逻辑运算符查询 :

查询年龄不在20岁到35岁之间的学生: select * from students where not (age >= 20 and age <= 35);

模糊查询 :

like是模糊查询关键字
%表示任意多个任意字符

查询姓杨或张的学生: select * from students where name like '杨%' or name like '%靖张';

空判断查询:

判断为空使用: is null

判断非空使用: is not null

查询没有填写体重的学生: select * from students where weight is null;

相关推荐
codeejun1 小时前
每日一Go·MySQL-20、SQL 性能调优实战总结
sql·mysql·golang
CoderYanger2 小时前
Java EE 进阶:11. SpringBoot 统一功能处理(第四弹):@ControllerAdvice 源码分析+案例代码
java·数据库·spring boot·后端·spring·java-ee·mybatis
TDengine (老段)2 小时前
TDengine 读缓存与 LAST 查询完全指南
大数据·数据库·物联网·缓存·时序数据库·tdengine·涛思数据
FungLeo4 小时前
FengCMS · PHP+MySQL 升级实录 · 输出转义的度:面包屑双重编码、默认转义与 cms_html()信任声明
mysql·html·php·fengcms·输出转义
Decay__5 小时前
PostgreSQL 用户权限与安全 —— 角色体系、GRANT 授权、pg_hba.conf 认证、行级安全与审计
运维·数据库·sql·postgresql
Escalating_xu6 小时前
【MySQL】索引原理(上):从数据页到 B+ 树,弄懂聚簇索引、回表与覆盖索引
数据库·mysql
FungLeo6 小时前
FengCMS ·PHP+MySQL升级实录 · 富文本清洗配置实战:白名单、URI scheme、禁 iframe/id、实例缓存
mysql·缓存·php·xss·fengcms
DataY轻量数据平台6 小时前
MongoDB 怎么做 CDC?不用 Debezium,Change Streams 就是它的“binlog”
数据库·mongodb
djjjx.7 小时前
Mysql数据库基础篇(十):从磁盘 IO 到 B+ 树:图解 MySQL 索引的底层演进、Page 结构、目录机制与 IO 优化原理
数据库·mysql
En^_^Joy7 小时前
LangChain消息系统全解析:从基础到实战(四)
数据库·microsoft·langchain