The order in which mysql select statements are executed
This article mainly explains "the order of execution of mysql select sentences". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the execution order of mysql select sentences".
SELECT statement definition
A completed SELECT statement contains optional clauses. The definition of the SELECT statement is as follows:
[] []
The SELECT clause is required, and other clauses such as WHERE clause, GROUP BY clause, and so on are optional.
In a SELECT statement, the order of clauses is fixed. For example, the GROUP BY clause does not precede the WHERE clause.
SELECT statement execution order
The execution order of the clauses in the SELECT statement is different from the input order of the subclauses of the SELECT statement, so it is not executed from the SELECT clause, but in the following order:
Start-> FROM clause-> WHERE clause-> GROUP BY clause-> HAVING clause-> ORDER BY clause-> SELECT clause-> LIMIT clause-> final result
After each clause is executed, it produces an intermediate result for the next clause to use. If a clause does not exist, skip it.
Thank you for your reading, the above is the content of "the order of execution of mysql select statements". After the study of this article, I believe you have a deeper understanding of the execution order of mysql select statements, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!