当前位置:网站首页>Oracle advanced SQL qualified query
Oracle advanced SQL qualified query
2022-06-24 07:53:00 【Mr. Li, a prodigy】
One must keep writing , In order not to be submerged by the vast sea of people
Articles are constantly updated , You can search by wechat 【 Xiaoqi JAVA interview 】 First time reading , reply 【 Information 】 Access to benefits , reply 【 project 】 Get the source code of the project , reply 【 The resume template 】 Get resume template , reply 【 Learning Roadmap 】 Get a learning roadmap .

List of articles
- One 、 Relational operator
- Two 、 Logical operators
- 3、 ... and 、 Range operation
- Four 、 Empty judgment
- 5、 ... and 、IN The operator
- 6、 ... and 、 Fuzzy query
- 7、 ... and 、 Query sequence
- 1、 Query all students , And in order of age
- 2、 Query all students , And in order of age
- 3、 Query all students , And in order of age , If they are of the same age, they will be sorted according to the student number from small to large
- 4、 Query all students , And in order of age , If they are of the same age, they will be sorted according to the student number
- 8、 ... and 、 summary
Relationship between operation :>、=、<、>=、<=、!=、<>
Range operation :between…and
Empty judgment :is null、is not null
IN Judge :in、not in
Fuzzy query :like、not like
Logical operations :and( And )、or( or )、not( Not )
One 、 Relational operator
1、 Query age is less than 20 Of the students
select * from student where age < 20;
2、 Check all male students
select * from student where sex=' male ';
3、 Query all students who are not male students
Either of the following is OK
select * from student where sex != ' male ';
select * from student where sex <> ' male ';
Two 、 Logical operators
and、or
1、 Query is not male but younger than 20 Classmate
select * from student where sex != ' male ' and age < 20;
2、 The query is a female classmate or older than 20 Classmate
select * from student where sex = ' Woman ' or age > 20;
3、 The query age is less than 20 Classmate
Either of the following is OK
select * from student where age < 20;
select * from student where age not >= 20;
3、 ... and 、 Range operation
1、 The age of inquiry is 10 To the age of 20 Students aged between
Either of the following is OK , however between Is an operator , The other is a relational operator >= Add a logical operator and, therefore between It's more efficient .
select * from student where age between 10 and 20;
select * from student where age >= 10 and age <= 20;
2、 The query in 1998 year 9 Students born in September
select * from student where birthday between '01-9 month -98' and '30-9 month -1998';
Four 、 Empty judgment
1、 Query students whose names are not empty
select * from student where name is not null;
5、 ... and 、IN The operator
1、 Look up the students whose names are Zhang San and Li Si
select * from student where name in (' Zhang San ',' Li Si ');
2、 Query the students whose names are Zhang Sanhe and Kong
select * from student where name in (' Zhang San ',null);
3、 Query the students whose names are not Zhang Sanhe
select * from student where name not in (' Zhang San ',null);
Here we need to pay attention to , When not in There is null when , No results can be found from the query .
6、 ... and 、 Fuzzy query
“_”: Match any one of the symbols .
“%”: Match any symbol , It can be 0、1、2、 Multiple symbols .
1、 Inquire about the classmate surnamed Li
select * from student where name like ' Li %';
2、 Inquire about the classmate surnamed Li , And the name has only two words
select * from student where name like ' Li _';
3、 The query name contains “ handsome ” My classmate
select * from student where name like '% handsome %';
7、 ... and 、 Query sequence
order by [ Sort rule ]
Default and asc Positive sort
desc It's in reverse order
1、 Query all students , And in order of age
select * from student order by age;
2、 Query all students , And in order of age
select * from student order by age desc;
3、 Query all students , And in order of age , If they are of the same age, they will be sorted according to the student number from small to large
select * from student order by age desc,sno;
4、 Query all students , And in order of age , If they are of the same age, they will be sorted according to the student number
select * from student order by age desc,sno desc;
8、 ... and 、 summary
The relevant contents here have not been sorted out yet , The article continues to be updated later , Recommended collection .
The commands involved in the article must be typed several times each like me , Only in the process of knocking can you find out whether you really master the command .
You can search by wechat 【 Xiaoqi JAVA interview 】 First time reading , reply 【 Information 】 Access to benefits , reply 【 project 】 Get the source code of the project , reply 【 The resume template 】 Get resume template , reply 【 Learning Roadmap 】 Get a learning roadmap .
边栏推荐
- OpenGauss数据库在 CentOS 上的实践,配置篇
- Smart pointer remarks
- 关于h5页面苹果手机使用fixed定位tabbar最底部时遮挡内容问题
- Alibaba cloud full link data governance
- 2022年PMP项目管理考试敏捷知识点(1)
- Take my brother to make a real-time Leaderboard
- Standing at the center of the storm: how to change the engine of Tencent
- 线程的阻塞问题
- 行内元素、块元素、行内块元素
- 开放合作,共赢未来 | 福昕鲲鹏加入金兰组织
猜你喜欢
随机推荐
Open cooperation and win-win future | Fuxin Kunpeng joins Jinlan organization
Introduction of model compression tool based on distiller
Configure your own free Internet domain name with ngrok
日期、时间库使用备注
用Ngrok 配置属于自己的免费外网域名
Teach you how to use the reflect package to parse the structure of go - step 2: structure member traversal
Bit operation
LeetCode练习——跳跃游戏、组合求和
Thread support
鸿蒙开发四
OpenGauss数据库在 CentOS 上的实践,配置篇
向量操作与坐标转换相关方法
Jenkins is too old try it? Cloud native ci/cd Tekton
Quickly set up PgSQL for serverless
Practice of opengauss database on CentOS, configuration
闲谈:3AC到底发生了什么?
POM configuration provided and test
位运算
Thread considerations
LeetCode 207:课程表(拓扑排序判断是否成环)








