当前位置:网站首页>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 .
边栏推荐
猜你喜欢
随机推荐
Chapter 2 line graph of canvas
duilib 显示内存图片
Oracle-高级SQL限定查询
1-4metasploitable2介绍
LeetCode 515 在每个数行中找最大值[BFS 二叉树] HERODING的LeetCode之路
[special session] SME growth plan - ECS special session
【008】表格数据逐行筛选,跳出for循环及跳过本次循环思路_#VBA
毕业两年月薪36k,说难也不难吧
IndexError: Target 7 is out of bounds.
Pair class notes
【Django中运行scrapy框架,并将数据存入数据库】
Any remarks
调用Feign接口时指定ip
Jenkins 太老了 试试它?云原生 CI/CD Tekton
Standing at the center of the storm: how to change the engine of Tencent
免费ICP域名备案查接口
Hongmeng OS development III
图形技术之管线概念
位运算
Tuple remarks







