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;

相关推荐
阿里嘎多哈基米20 小时前
SQL 层面行转列
数据库·sql·状态模式·mapper·行转列
抠脚学代码20 小时前
Ubuntu Qt x64平台搭建 arm64 编译套件
数据库·qt·ubuntu
jakeswang20 小时前
全解MySQL之死锁问题分析、事务隔离与锁机制的底层原理剖析
数据库·mysql
Heliotrope_Sun21 小时前
Redis
数据库·redis·缓存
一成码农21 小时前
MySQL问题7
数据库·mysql
吃饭最爱21 小时前
JUnit技术的核心和用法
数据库·oracle·sqlserver
专注API从业者21 小时前
Python/Java 代码示例:手把手教程调用 1688 API 获取商品详情实时数据
java·linux·数据库·python
雨落Liy21 小时前
SQL 函数从入门到精通:原理、类型、窗口函数与实战指南
数据库·sql
Kt&Rs1 天前
MySQL复制技术的发展历程
数据库·mysql
小小菜鸡ing1 天前
pymysql
java·服务器·数据库