当前位置:网站首页>I study database at station B (4): DQL
I study database at station B (4): DQL
2022-07-03 19:15:00 【Who can take me to learn penetration】
Last one : I am here b Station learning database ( 3、 ... and ): constraint
Data preparation
1、 Create databases and tables 
2、 Add data 

Two 、 Simple query
1、 Check all products ( Generally, the method of choosing the second line )
result :
2、 Query the product name and price 
result :
3、 Alias query , Use keywords as,as Omission
(1) Table alias 
(2) List aliases 

4、 Remove the repetition value (-distinct)

5、 Arithmetic query 

3、 ... and 、 Operator operation
1、 Arithmetic operator 
example : Add... To the price of all goods 10 element 

2、 An operator ( Understanding can )



3、 For comparison operators and logical operators, see the following conditional query
Four 、 Conditions of the query
1、 Query the trade name as “ Haier washing machine ” All information about our products 

2、 Inquiry price is not 800 All of our products ( Three lines are OK , Usually choose the first line )

3、 The inquiry price is greater than or equal to 60 The goods 
4、 Inquire about the price of goods in 200 To 1000 All goods between 
5、 The inquiry of commodity price is 200 or 800 All of our products 
6、 Query contains ‘ pants ’ All the goods of the word 
7、 Query to ‘ The sea ’ All products beginning with the word 
8、 The second word is ‘ Kou ’ All of our products 
9、 Use least For the minimum 
10、 Use greatest For maximum

5、 ... and 、 Sort query
1、 Single condition 
2、 Multiple conditions 
3、 To reorder 
6、 ... and 、 Aggregate query
1、 Concept
Aggregate function queries are vertical queries , It calculates the values of a column , And then return a single value . Besides , Aggregate functions ignore null values .
2、 Aggregate functions 
Be careful :(1)count The argument of the function is asterisk (*), Then count the number of all records . If the parameter is a field , Excluding statistics null Number of records of value .
(2)sum、max、min and avg Function to ignore null Existence of value .
3、 example 

7、 ... and 、 Group query
1、 Count the number of goods in each category 

Be careful : After grouping select Only grouping fields and aggregate functions can be written behind the
2、 Count the number of commodities in each category , And only show that the number is greater than 4 Information about 

8、 ... and 、 Paging query
1、 Format
Before display n strip :
select Field 1, Field 2… from indicate limit n
Pagination display :
select Field 1, Field 2… from indicate limit m,n
m: Integers , Indicates which index to start from , Calculation method ( The current page -1)
n: Integers , Indicates how many pieces of data to query
2、 operation
(1) Inquire about product The first five records of the table 
(2) Start with the fourth line , Show 5 strip 
Nine 、insert into select sentence
1、 brief introduction
When importing data from one table into another table
2、 Format 
Be careful : Request target table Table2 There must be
3、 example 
Ten 、 summary









边栏推荐
- Floating source code comment (38) parallel job processor
- Help change the socket position of PCB part
- The more you talk, the more your stupidity will be exposed.
- FBI warning: some people use AI to disguise themselves as others for remote interview
- 利用可视化结果,点击出现对应的句子
- 【Proteus仿真】用24C04与1602LCD设计的简易加密电子密码锁
- [new year job hopping season] test the technical summary of interviewers' favorite questions (with video tutorials and interview questions)
- Why should the gradient be manually cleared before back propagation in pytorch?
- SSM整合-前后台协议联调(列表功能、添加功能、添加功能状态处理、修改功能、删除功能)
- How to design a high concurrency system
猜你喜欢

The installation path cannot be selected when installing MySQL 8.0.23

leetcode:11. 盛最多水的容器【双指针 + 贪心 + 去除最短板】

Analysis of dart JSON encoder and decoder
![[leetcode weekly race] game 300 - 6110 Number of incremental paths in the grid graph - difficult](/img/8d/0e515af6c17971ddf461e3f3b87c30.png)
[leetcode weekly race] game 300 - 6110 Number of incremental paths in the grid graph - difficult

2020 intermediate financial management (escort class)
![Leetcode: 11. Récipient contenant le plus d'eau [double pointeur + cupidité + enlèvement de la plaque la plus courte]](/img/d4/cbbaec40119be6cb5594899e348261.png)
Leetcode: 11. Récipient contenant le plus d'eau [double pointeur + cupidité + enlèvement de la plaque la plus courte]
![[leetcode] [SQL] notes](/img/8d/160a03b9176b8ccd8d52f59d4bb47f.png)
[leetcode] [SQL] notes

01. Preparation for automated office (free guidance, only three steps)
![235. Ancêtre public le plus proche de l'arbre de recherche binaire [modèle LCA + même chemin de recherche]](/img/f5/f2d244e7f19e9ddeebf070a1d06dce.png)
235. Ancêtre public le plus proche de l'arbre de recherche binaire [modèle LCA + même chemin de recherche]

东数西算拉动千亿产业,敢啃“硬骨头”的存储厂商才更有机会
随机推荐
Nous avons fait une plateforme intelligente de règlement de détail
【水质预测】基于matlab模糊神经网络水质预测【含Matlab源码 1923期】
Record: install MySQL on ubuntu18.04
The earliest record
Analyse du Code du planificateur ego bspline Section Optimizer (1)
[leetcode] [SQL] notes
EGO Planner代碼解析bspline_optimizer部分(1)
Driveseg: dynamic driving scene segmentation data set
Php based campus lost and found platform (automatic matching push)
[academic related] how to find the innovation of top papers? Chinese universities won the CVPR Best Student Thesis Award for the first time
为什么要做特征的归一化/标准化?
Differential constrained SPFA
SSM整合-前后台协议联调(列表功能、添加功能、添加功能状态处理、修改功能、删除功能)
Dynamic planning -- expansion topics
Ego planner code parsing Bspline_ Optimizer section (2)
01. Preparation for automated office (free guidance, only three steps)
This Chinese numpy quick look-up table is too easy!
Ego planner code parsing Bspline_ Optimizer section (3)
Hard disk monitoring and analysis tool: smartctl
Why should the gradient be manually cleared before back propagation in pytorch?