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;

相关推荐
一 乐10 分钟前
林业资源管理|基于java + vue林业资源管理系统(源码+数据库+文档)
java·数据库·vue.js·spring boot·论文·毕设·林业资源管理系统
l1t10 分钟前
DeepSeek总结的PostgreSQL 18 EXPLAIN 中新增的 Index Searches
数据库·postgresql
g***279913 分钟前
使用 Canal 实时从 MySql 向其它库同步数据
数据库·mysql
u***357415 分钟前
对基因列表中批量的基因进行GO和KEGG注释
开发语言·数据库·golang
小光学长26 分钟前
基于ssm的校园约自习网站23i21xj4(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。
java·数据库·spring
LSL666_30 分钟前
1.3 云服务器安装和使用Redis
数据库·redis·缓存
LSL666_34 分钟前
1.4 Redis服务端和客户端
数据库·redis·缓存
LSL666_1 小时前
1.7 Redis多数据库
数据库·redis·缓存
低代码布道师1 小时前
Next.js 16 全栈实战(三):数据库建模与动态菜单实现
开发语言·javascript·数据库
远方16091 小时前
114-Oracle Database 26ai在Oracle Linux 9上的OUI图形界面安装
linux·服务器·数据库·sql·oracle·database