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;

相关推荐
禹凕1 小时前
MySQL——基础知识(正则表达式)
数据库·mysql·正则表达式
SmartBrain2 小时前
FastAPI实战(第三部分):浏览历史的接口开发详解
数据库·人工智能·aigc·fastapi
山岚的运维笔记2 小时前
SQL Server笔记 -- 第77章:文件组
数据库·笔记·sql·microsoft·oracle·sqlserver
有点心急10213 小时前
Python 入门
服务器·数据库·python
独泪了无痕3 小时前
Mac Homebrew 安装 MySQL 指南
数据库·mysql·mac
l1t3 小时前
DeepSeek总结的PostgreSQL 19新功能:第二部分
数据库·postgresql
fchampion3 小时前
MYSQL自学笔记
数据库·笔记·mysql
XiaoHu02074 小时前
MySQL基础(第一弹)
数据库·c++·mysql
惜分飞4 小时前
rose双机引起文件系统损坏使得数据库异常故障处理---惜分飞
数据库·oracle
小小工匠4 小时前
大模型开发 - SpringAI之MySQL存储ChatMemory
mysql·spring ai