The complete syntax of the select statement is: SELECT DISTINCT <select_list> FROM <left_table> <join_type> JOIN <right_table> ON <join_condition> WHERE <where_condition> GROUP BY <group_by_list> HAVING <having_condition> ORDER BY <order_by_condition> LIMIT <limit_number> Execution order: from →join →on →where →group by →having →select →order by →limit (1) The role of each keyword: from: From which data table do you want to retrieve data? If there is a join, perform a Cartesian product (cross join) on the first two tables in the FROM clause to generate a temporary table (n×m rows) on: Conditionally filter the above temporary tables left/right (join): Supplement the left or right table to keep it complete. If there are multiple associated tables, the intermediate table continues the above two steps for the next table.
sum: aggregate function
distinct:
(2) The difference between on and where:
(3) The difference between having and where:
(4) Usage of count When using count(column name) and a null value appears in a column, count(*) will still be calculated, but count(column name) will not. The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: After Webpack-cli is successfully installed, check the webpack -v error case for details
>>: A brief discussion on how to modify/set the environment variable JAVA_HOME under Linux
This article shares the specific code of js+Html ...
1. haslayout and bfc are IE-specific and standard ...
1. Introduction to Docker 1.1 Virtualization 1.1....
The most important logs in the MySQL log system a...
Table of contents 1 Introduction 2 Prerequisites ...
Table of contents 1. Background: 2. Design ideas:...
This example takes the installation of Python 3.8...
Use of stored procedure in parameters IN paramete...
It is also very simple to deploy Django projects ...
mysqladmin is an official mysql client program th...
Select the category selection. After testing, IE ...
When MySQL performs DDL operations such as alter ...
Recently, after refreshing the website, 503 Servi...
Optimistic Locking Optimistic locking is mostly i...
Problem Reproduction When using HTML for editing,...