current position:Home>MySQL__ Query of data processing
MySQL__ Query of data processing
2022-05-15 05:19:59【InfoQ】
1— basic SELECT sentence
- SELECT Identifies which columns to select .
- FROM Identifies which table to choose from .


- SQL LanguageCase insensitive.
- SQL It can be written on one or more lines
- Keywords cannot be abbreviated or separated
- Each clause should be written separately .
- Use indentation to improve the readability of statements .
Alias of column
- Rename a column .
- Easy to calculate .
- Keep up with the column name ,You can also add keywords between column names and aliases ‘AS’, Aliases use double quotes,To include spaces or special characters in the alias and be case sensitive.
Use the alias

- The string can be SELECT A character in the list , Numbers , date .
- Dates and characters can only appear in single quotes .
- Whenever a row is returned , The string is output once .
Display table structure

2— Filtering and sorting data
- Use WHERE Clause , Filter out rows that do not meet the criteria .








- Use LIKE The operation selects similar values
- Selection criteria can contain characters or Numbers :
- ‘%’ and ‘-’ Can be used at the same time .




- Use ORDER BY Clause ordering
- ORDER BY Clause in SELECT End of statement .



- according to ORDER BY Order of the list .

- Can be used not in SELECT Sort the columns in the list .
3 — Group function

- AVG()
- COUNT()
- MAX()
- MIN()
- SUM()




Grouped data






- Rows have been grouped .
- Group functions are used .
- Satisfy HAVING The grouping of conditions in the clause will be displayed .

4 — Multi-table query


- If you want to query the goddess name and the corresponding male god name , What about swelling ?


- Omit the join condition. The join condition is invalid. All rows in all tables are connected to each other in order to avoid Cartesian set , Can be in WHERE Add a valid connection condition .
- stay WHERE Clause .
- When there are the same columns in the table , Prefix the column name with the table name


- Columns with the same column name in different tables can be usedThe table aliasDistinguish .
- If a table alias is used , It's in select Statement needs to use table alias instead of table name
- Table aliases support up to 32 Character length , But the less advice the better
- Using aliases can simplify queries .
- Using a table name prefix can improve execution efficiency .



- Connect nTables , Need at least n-1 Connection conditions. for example : Connect
- In natural connection, columns with the same name are used as connection conditions .
- This connection condition is separate from other conditions .
- ON Clause makes the statement more readable.
- classification : Internal connection [inner] join on External connection left external connection left [outer] join on Right connection right [outer] join on




- Connect nTables , Need at least n-1 Connection conditions. for example : Connect





copyright notice
author[InfoQ],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/131/202205111232226856.html
The sidebar is recommended
- Online FAQ positioning FAQ what is the cause of the high load problem?
- What is the function of getstatic, a common tool for online FAQs?
- Android 11 new soft keyboard occlusion / animation solution
- Common tools for online FAQs include?
- How does SAP commerce cloud configure new applications for storefront
- In the CMS GC process, what is the reason why the business thread puts objects into the old generation (the characteristics of concurrent collection)?
- How good and accurate is the recommendation?
- Online FAQ positioning FAQs what are the causes of continuous GC problems?
- Does the data reflect the real viewing experience?
- What are the reasons for fullgc (throw oom if FGC recovery is invalid)?
guess what you like
Algorithm improvement - basic algorithm (turtle speed multiplication)
[C + +] sword finger offer 10 - I. Fibonacci sequence
Online FAQ positioning FAQ nosuchmethodexception what is the cause of the problem?
IOS enables native im development
What is the common function of SM?
"Automated testing" a new generation of Web front-end automated testing framework - playwright, get started quickly!
Online FAQ positioning FAQ what is the cause of the high load problem?
What is the function of watch, a common tool for online FAQs?
Timeliness in recommender systems, Zhang Fuguo et al. ESWA 2017
Alibaba's open source Java diagnostic tool uses what methods to diagnose.
Random recommended
- What is the function of dashboard, a common tool for online FAQs?
- What is the role of JAD, a common tool for online FAQs?
- Online FAQ positioning FAQ what are the causes of high CPU utilization?
- 07 - explore the underlying principles of IOS | several OC objects [instance object, class object, metaclass], ISA pointer of object, superclass, method call of object and the underlying essence of class
- Extreme fox gitlab settled in Alibaba cloud computing nest to jointly improve the development experience on the cloud
- How does artificial intelligence help natural science
- Elementui upload file
- Modern CSS solution: CSS mathematical functions
- Create a general efficiency improvement solution for front desk + middle desk based on vue3 (network disk link)
- Brush 100 front-end high-quality interview real questions in 2 weeks, and the source code is complete
- Vue has reduced its workload by half since using components
- I built a front-end mock tool
- About uboot -- Ping virtual machine Ubuntu operation
- Video transcoder editready for Mac
- [taro] taro gets the detailed attributes of the element (solved)
- Picture and text difference comparison tool: kaleidoscope for Mac
- Background of spatiotemporal artificial intelligence
- The top 10 of oceanbase database competition was born, and the integration of industry and education accelerated the training of database talents
- China brand Day | Youxuan software: strengthen its own brand and fight for China's database industry
- New feature release of gaussdb (for redis): enhanced prefix scanning and multi rent isolation
- CICC purchases the original maintenance service of gbase database in 2022
- Java implementation sequence table
- Simple implementation of linked list in Java
- C + + parameterless constructor (difference between stack and heap)
- Vue NPM startup error - solution
- With the introduction of Alibaba cloud database into Shandong medical insurance information platform, the settlement response speed increased by nearly 10 times
- Yixinhuachen was selected into the atlas of relevant manufacturers in the primary market of China's big data industry
- 2021-06-05 Java Foundation (day four): two ways of locking
- Android bangs screen and water drop screen are the best overall adaptation scheme
- Don't take detours in Android learning
- Android realizes Gaode map track playback
- 2021 preparing for the 1000 Java interview questions that gold, silver and four must brush
- The database function queries the MySQL database at the correct time
- Linux changes the SSH connection mode, changes the public key to the user name and password, and logs in
- Websocket + springboot message active push
- Java common classes and methods
- Go connect to the database (simple query learning)
- HTTP - understand HTTP protocol (I)
- Spring boot quickly switches the configuration of development environment and production environment (application. YML)
- Java gets the date of the previous day