sql execution order

sql execution order

1. The first clause to be processed is the FROM clause
2. Each step produces a virtual table which is used as input for the next step.

Among them, select and from are required, and other keywords are optional. The execution order of these six keywords is not the same as the writing order
of the sql statement, but
from--where--group is executed in the following order by--having--select--order by,
from: which data table to
retrieve
data
from Conditional
select: view which column in the result set, or the calculation result of the column
order by: in what order to view the returned data


from clause--execution order is from back to front, right to left
where clause- -The execution order is bottom-up, right-to-left


group by--The execution order is grouped from left to right The
having clause is very resource-intensive, try to use the
select clause as little as possible--use less *, try Field Name.
order by clause -- the execution order is from left to right, which is very resource-intensive.

Nested queries are done by taking the outermost table as a table and executing subqueries each time.


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326255590&siteId=291194637