当前位置:网站首页>MySQL - Basic select statement
MySQL - Basic select statement
2022-06-11 19:35:00 【Can't learn java】
List of articles
1、DQL(Data Query Language: Data query language )
- All query operations use it
SELECT - The core language in database , The most important statement
- The most frequently used statement
2、 Specify query fields
SELECT * FROM Table name ; -- Query all field information in the table
SELECT Field 1, Field 2 FROM Table name ; -- Query all the information of the specified field
SELECT Field 1 AS Alias 1, Field 2 AS Alias 2 FROM Table name ; -- Alias fields ( You can also alias a table )
SELECT CONCAT(' character string 1',' character string 2',···) ; -- String concatenation
SELECT DISTINCT Field name 1 FROM Table name ; -- Duplicate data found , duplicate removal
3、where Conditional clause
- effect : Retrieve data eligible Value
- Logical operators :
Operator grammar describe and / && a and b / a&&b Logic and , All true , The result is true or / || a or b / a||b Logic or , One of them is true , The result is true not / ! not a / !a Logic is not , True or false , False is true - Fuzzy query :
Operator grammar describe IS NULL a is null If the operator is NULL, The result is true IS NOT NULL a is not null If the operator is not NULL, The result is true BETWEEN a between b and c if a stay b and c Between , The result is true LIKE a like b SQL matching , If ah matches b, The result is true IN a in (a1,a2,a3···) hypothesis a stay a1 perhaps a2··· One of the values , The result is true
4、 League table query
| operation | describe |
|---|---|
| inner join | If there is at least one match in the table , Just go back |
| left join | All values are returned from the left table , Even if there is no match in the right table |
| right join | All values are returned from the right table , Even if there is no match in the left table |
Connect your own table to your own table , The core : One table can be split into two identical tables
SELECT a. Field name AS ' Parent column ' b. Field name AS ' Sub column ' FROM Table name 1 AS a, Table name 1 AS b WHERE a. Field name 1 = b. Field name 2;
5、 Paging and sorting
Sort :ORDER BY
SELECT Field name 1, Field name 2,··· FROM Table name ORDER BY Field name 1 ASC/DESC[, Field name 2 ASC/DESC,···];Pagination :LIMIT
SELECT * FROM Table name LIMIT Starting value , Page size ;
6、 Subquery
where The latter condition is select A result set :
SELECT Field name FROM Table name WHERE Field name 1 = (SELECT Field name 1 FROM Table name WHERE Field name 1= Conditional expression );
7、 Aggregate functions
SELECT Field name 1,AVG( Field name 1) FROM Table name GROUP BY Field name 1 [HAVING Conditional expression ];
边栏推荐
- Introduction to go language (V) -- branch statement
- MySQL federated index and BTREE
- Anaconda installation, jupyter notebook default startup path modification and nbextensions plug-in installation
- Go语言入门(六)——循环语句
- MOS transistor 24n50 parameters of asemi, 24n50 package, 24n50 size
- Judge whether it is a balanced binary tree
- "Case sharing" based on am57x+ artix-7 FPGA development board - detailed explanation of Pru Development Manual
- [untitled]
- Introduction to typescript
- [help] how can wechat official account articles be opened in an external browser to display the selected messages below?
猜你喜欢

Raki's notes on reading paper: memory replace with data compression for continuous learning

AHB2APB_bridge 设计

highcharts设置柱状图宽度、渐变、圆角、柱子上方数据

2022各大厂最新总结的软件测试宝典,看完不怕拿不到offer
![[signal denoising] signal denoising based on FFT and fir with matlab code](/img/4c/782afe2652a674d64fccd8d28304ed.png)
[signal denoising] signal denoising based on FFT and fir with matlab code

Multimodal learning toolkit paddlemm based on propeller

SLAM APP

Summary 111111111111111111111
![[C language questions -- 10 simple questions for leetcode]](/img/60/c7aca1392eb85c3a7185abe4c82f16.png)
[C language questions -- 10 simple questions for leetcode]

【Multisim仿真】利用运算放大器产生方波、三角波发生器
随机推荐
Automated test requirements analysis
Pymysql uses cursor operation database method to encapsulate!!!
[assembly] analysis of Experiment 7 of the fourth edition of assembly language
模块八作业
Template and requirements of curriculum design of reinforced concrete structure in autumn 21 of Dagong [standard answer]
Yolov3 pytoch code and principle analysis (II): network structure and loss calculation
Introduction to go language (VI) -- loop statement
AHB2Standard_handshake_bridge 设计
Understand how to get started with machine learning to quantify transactions?
MySQL——事务
CMU 15-445 database course lesson 5 text version - buffer pool
Practice of tag recognition based on Huawei cloud image
Postman configuration Chinese
Lecture 30 linear algebra Lecture 2 Matrix
何恺明团队的“视频版本MAE”,高效视频预训练!Mask Ratio高达90%时效果也很好!...
图床:PicGo+腾讯云+typora
This article introduces you to the infrastructure of sofaregistry
POJ 1458 longest common subsequence (dynamic planning exercise)
SLAM APP
懂机器学习如何入门量化交易?