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;

相关推荐
Anastasiozzzz1 小时前
深入研究RAG: 在线阶段-查询&问答
数据库·人工智能·ai·embedding
卤炖阑尾炎4 小时前
基于 MySQL 主主复制 + HAProxy+Keepalived 构建高可用集群实战
数据库·mysql
Dxy12393102164 小时前
MySQL 如何高效删除大量数据:策略与最佳实践
数据库·mysql·oracle
倔强的石头_5 小时前
从 “不得不存” 到 “战略必争”:工业数据的价值觉醒之路
数据库
倔强的石头_5 小时前
新型电力系统应该用什么数据库?——时序数据库选型与落地实战
数据库
南汐以墨6 小时前
一个另类的数据库-Redis
数据库·redis·缓存
RInk7oBjo6 小时前
spring-事务管理
数据库·sql·spring
希望永不加班6 小时前
SpringBoot 数据库连接池配置(HikariCP)最佳实践
java·数据库·spring boot·后端·spring
黑牛儿7 小时前
MySQL 索引实战详解:从创建到优化,彻底解决查询慢问题
服务器·数据库·后端·mysql
捧月华如7 小时前
RAG 入门-向量存储与企业级向量数据库 milvus
数据库·milvus