SQL查询-范围查询(区间查询)
--范围查询(区间查询)
--in()
--查询年龄为18,28,38的人 select *from student where age=18 or age=28 or age=38;
select *from student where age in(18,28,38);
--not in
--查询年龄为18,28,38的人 select *from student where not (age=18 or age=28 or age=38);
select *from student where age not in (18,28,38);
--between...and...
--查询12-18的人
select *from student where age between 12 and 18;
-- not between...and...
-- 查询年龄不在12-18的人
select *from student where age not between 12 and 18;
-- 失败select *from student where age not (between 12 and 18);
--判断空
-- is null
-- 判断年龄是否为空
select *from student where age is null;
-- is not NULL
-- 判断年龄不为空
select *from student where age is not null;
(资源库 www.zyku.net)
原文链接:https://www.cnblogs.com/jum-bolg/p/11235427.html
上一篇:MySQL查询结果也按照in里面的字段值顺序排序的一种解决办法
栏 目:MySQL
下一篇:MySQL中的模糊查询使用教程
本文标题:SQL查询-范围查询(区间查询)
本文地址:https://www.zyku.net/mysql/2295.html
您可能感兴趣的文章
- 07-05MySQL查询结果也按照in里面的字段值顺序排序的一种解
- 06-24帝国CMS自定义列表查询SQL语句,怎么从第N条开始查询
- 03-16Yii1.1中通过Sql查询进行的分页操作
- 03-13分享一些实用的WordPress SQL查询语句
- 03-04wordpress最常用SQL查询语句大集合
- 02-18通过sql准确查出一天数据的方法
- 02-18yii数据库的查询方法
- 04-16Sublime Text编辑器如何显示顶部的菜
- 03-25一条命令更新Composer版本
- 11-30微信怎么查看实时公交
- 11-26搜狗输入法如何设置键盘背景
- 06-21阿里云网盘PC/Mac桌面版正式上线
- 09-26vivox70pro+怎么关闭屏幕锁定
- 09-13小米台灯如何绑定手机
- 09-22iPhone13怎样关闭5G
- 04-03基于JQuery和原生JavaScript实现网页
- 02-20notepad++ 设置及使用技巧
- 11-03小度蓝牙耳机如何重新连接手机
- 08-15张小龙的「不克制」
- 03-16详解几种Linux 查询外网出口IP命令的

最近更新
阅读排行
猜你喜欢
- 02-22DedeCMS首页列表页实时动态调用文章点
- 11-05notes plus录音方法介绍
- 09-26vivox70pro+在哪里更改字体大小
- 02-18yii2超好用的日期组件和时间组件
- 09-29iphone13nfc功能在哪里
- 03-10浏览器的User Agent Stylesheet解决方
- 11-26procreate pocket恢复示例作品方法介
- 02-17帝国CMS-阅读心情插件下载
- 12-19HTML <link> 标签
- 12-25新渝商-新渝商应用软件功能介绍