当前位置:网站首页>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









边栏推荐
- [leetcode weekly race] game 300 - 6110 Number of incremental paths in the grid graph - difficult
- application
- Nous avons fait une plateforme intelligente de règlement de détail
- Pan for in-depth understanding of the attention mechanism in CV
- 235. 二叉搜索樹的最近公共祖先【lca模板 + 找路徑相同】
- Pecan — Overview
- 达梦数据库的物理备份和还原简解
- Go home early today
- 为什么要做特征的归一化/标准化?
- Counting from the East and counting from the West will stimulate 100 billion industries. Only storage manufacturers who dare to bite the "hard bone" will have more opportunities
猜你喜欢

【LeetCode】【SQL】刷题笔记
![[wallpaper] (commercially available) 70 wallpaper HD free](/img/21/6802da1056a18157b15de85df60cf5.jpg)
[wallpaper] (commercially available) 70 wallpaper HD free

FBI警告:有人利用AI换脸冒充他人身份进行远程面试
![235. The nearest common ancestor of the binary search tree [LCA template + same search path]](/img/f5/f2d244e7f19e9ddeebf070a1d06dce.png)
235. The nearest common ancestor of the binary search tree [LCA template + same search path]

leetcode:556. 下一个更大元素 III【模拟 + 尽可能少变更】

Streaming media server (16) -- figure out the difference between live broadcast and on-demand

FBI warning: some people use AI to disguise themselves as others for remote interview

Thesis study - 7 Very Deep Convolutional Networks for Large-Scale Image Recognition (3/3)
![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]

我们做了一个智能零售结算平台
随机推荐
Free hand account sharing in September - [cream Nebula]
Why should we do feature normalization / standardization?
[new year job hopping season] test the technical summary of interviewers' favorite questions (with video tutorials and interview questions)
Ego planner code parsing Bspline_ Optimizer section (2)
Record: install MySQL on ubuntu18.04
EGO Planner代码解析bspline_optimizer部分(3)
Sentinel source code analysis part II - sentinel dashboard console startup and configuration
Know what it is, and know why, JS object creation and inheritance [summary and sorting]
EGO Planner代码解析bspline_optimizer部分(1)
Does SQL always report foreign key errors when creating tables?
Basic principle of LSM tree
In addition to the prickles that pierce your skin, there are poems and distant places that originally haunt you in plain life
How to design a high concurrency system
Random numbers in a long range, is that right- Random number in long range, is this the way?
Record: pymysql is used in pycharm to connect to the database
Driveseg: dynamic driving scene segmentation data set
Pytorch introduction to deep learning practice notes 13- advanced chapter of cyclic neural network - Classification
Free year-end report summary template Welfare Collection
记录在模拟器中运行flutter时报的错
Webrtc[41] - Analysis of the establishment process of webrtc transmission channel