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;

相关推荐
Pocker_Spades_A1 小时前
基于代价模型的连接条件下推:复杂SQL查询的性能优化实践
数据库·sql·性能优化
huan1991101 小时前
Python使用PyMySQL操作MySQL完整指南
数据库·python·mysql
双星系统1 小时前
ABB机器人DSQC 679示教器电缆选型与故障排查(附原装型号对照表)
网络·数据库·机器人·工业4.0·工业机器人
TDengine (老段)1 小时前
TDengine 视图功能使用
大数据·数据库·servlet·时序数据库·tdengine·涛思数据
TDengine (老段)1 小时前
TDengine IDMP 运维指南 —— 部署架构
大数据·运维·数据库·架构·时序数据库·tdengine·涛思数据
Zzzzmo_1 小时前
【MySQL】索引详解
数据库·mysql
balmtv2 小时前
Linux(CentOS)安装 MySQL
linux·mysql·centos
huangliang07032 小时前
postgresql 日志中文乱码
数据库·postgresql
oioihoii3 小时前
从“功能实现”到“深度优化”:金仓数据库连接条件下推技术的演进之路
数据库·oracle
二狗mao4 小时前
整理了索引几道面试热题的简答
mysql