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;
MySQL where条件
代码真的养发2023-11-05 9:47
相关推荐
Lee川3 小时前
Milvus 实战:当 RAG 遇上向量数据库,从"玩具 Demo"到"生产可用的"那一步网管NO.15 小时前
SQL 排序分页精讲!ORDER BY+LIMIT 全套用法,报表分页MRSM_015 小时前
InfluxDB vs TimescaleDB,谁更适合你的场景CAE虚拟与现实5 小时前
Redis如何保证存和读的过程中数据的一致性?我爱cope8 小时前
【Agent智能体4 | 智能体AI的应用】知识分享小能手10 小时前
Flask入门学习教程,从入门到精通,数据库操作 — 知识点详解与案例代码(4)我是一颗柠檬10 小时前
【MySQL全面教学】MySQL基础SQL语句Day3(2026年)XS03010610 小时前
MyBatis动态SQL