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
Table of contents 1. Problem Description 2. Probl...
Table of contents 1. What is a template string? 2...
1. Write a split script (splitNginxLog.sh) * Beca...
Background: I want to install a SAP ECC server an...
Table of contents <template> <ul class=&...
Solution: Just set the link's target attribute...
This article example shares the specific code of ...
We better start paying attention, because HTML Po...
Table of contents Preface Simulating data Merged ...
MySQL download and installation (version 8.0.20) ...
Download link: Operating Environment CentOS 7.6 i...
Installation environment: CAT /etc/os-release Vie...
1. Text around the image If we use the normal one...
The detailed process of configuring the MySQL dat...
On web pages, we often encounter this situation: ...