Home >Database >Mysql Tutorial >Introduction to logical query processing in mysql (code example)

Introduction to logical query processing in mysql (code example)

不言
不言forward
2019-02-15 14:02:151541browse

This article brings you an introduction to logical query processing in mysql (code examples). It has certain reference value. Friends in need can refer to it. I hope it will be useful to you. helped.

Query processing can be divided into logical query processing and physical query processing.
Logical query processing indicates what results should be produced by executing the query.
Physical query processing indicates how the MySQL database obtains the result.
The two query methods may be completely different, but the results must be the same.

1. Logical query processing

In sql language, the first clause to be processed is always the FROM clause.

//示例
//前面的序号表示执行的顺序
(8) SELECT (9) DISTINCT<select_list>
(1) FROM<left_table>
(3) <join_type> JOIN <right_table>
(2)				ON<join_condition>
(4) WHERE <where_condition>
(5) GROUP BY<group_by_list>
(6) WITH {CUBE|ROLLUP}
(7) HAVING <having_condition>
(10) ORDER BY<order_by_list>
(11) LIMIT<limit_number>

You can see that FROM is executed first and LIMIT is executed last. Each operation produces a virtual table that serves as input to a process. These virtual tables are transparent to users, and only the virtual tables generated in the last step will be returned to users.

The above is the detailed content of Introduction to logical query processing in mysql (code example). For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete