当前位置:网站首页>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
边栏推荐
- [disease identification] machine vision lung cancer detection system based on Matlab GUI [including Matlab source code 1922]
- 235. 二叉搜索樹的最近公共祖先【lca模板 + 找路徑相同】
- Why should the gradient be manually cleared before back propagation in pytorch?
- 【光学】基于matlab涡旋光产生【含Matlab源码 1927期】
- Which do MySQL and Oracle learn?
- leetcode:556. 下一个更大元素 III【模拟 + 尽可能少变更】
- Record: writing MySQL commands
- Recommend a GIF processing artifact less than 300K - gifsicle (free download)
- What is the content of game modeling
- Hard disk monitoring and analysis tool: smartctl
猜你喜欢
[free sharing] kotalog diary2022 plan electronic manual ledger
【学术相关】顶级论文创新点怎么找?中国高校首次获CVPR最佳学生论文奖有感...
The online customer service system developed by PHP is fully open source without encryption, and supports wechat customer service docking
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
Day18 - basis of interface testing
This Chinese numpy quick look-up table is too easy!
[leetcode weekly race] game 300 - 6110 Number of incremental paths in the grid graph - difficult
235. Ancêtre public le plus proche de l'arbre de recherche binaire [modèle LCA + même chemin de recherche]
Using the visualization results, click to appear the corresponding sentence
Free hand account sharing in September - [cream Nebula]
随机推荐
I didn't cancel
User identity used by startup script and login script in group policy
leetcode:556. 下一个更大元素 III【模拟 + 尽可能少变更】
235. 二叉搜索樹的最近公共祖先【lca模板 + 找路徑相同】
High concurrency Architecture - read write separation
Flutter network and data storage framework construction-b1
Sustainable service business models
flask 生成swagger文档
Yolov3 network model building
Analysis of dart JSON encoder and decoder
Basic principle of LSM tree
Le changement est un thème éternel
我们做了一个智能零售结算平台
[optics] dielectric constant calculation based on MATLAB [including Matlab source code 1926]
ActiveMQ的基础
Web3 credential network project galaxy is better than nym?
The installation path cannot be selected when installing MySQL 8.0.23
Dart JSON编码器和解码器剖析
Pecan — @expose()
利用可视化结果,点击出现对应的句子