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;

相关推荐
e***0961 小时前
Sql Server数据库远程连接访问配置
数据库
2501_924064112 小时前
2025数据库性能测试工具:Utest、JMeter、HammerDB 等主流方案推荐
数据库·测试工具·jmeter·数据库性能测试·数据库负载测试·数据库压测工具·jmeter 压力测试
movie__movie2 小时前
秒杀库存扣减可以用redis原子自增么
数据库·redis·缓存
找不到、了3 小时前
MySQL 索引下推(ICP)的实战,彻底提升查询性能
数据库·mysql
b***67643 小时前
Springboot3 Mybatis-plus 3.5.9
数据库·oracle·mybatis
kitty_hi3 小时前
mysql主从配置升级,从mysql5.7升级到mysql8.4
linux·数据库·mysql·adb
q***13345 小时前
Linux系统离线部署MySQL详细教程(带每步骤图文教程)
linux·mysql·adb
王宪笙5 小时前
Qt之数据库使用示例
数据库·qt
q***42826 小时前
Redis 设置密码(配置文件、docker容器、命令行3种场景)
数据库·redis·docker
运维行者_6 小时前
网站出现 525 错误(SSL 握手失败)修复指南
服务器·网络·数据库·redis·网络协议·bootstrap·ssl