MySQL three-seed query
Brief:
One or three seed search
two or three seed query understanding model
first, MySQL three seed query
Where sub-query, from subquery, exists subquery
second, understanding the model:
2.1, a good model, easy for us to understand. When we write an SQL statement, we can understand it by the following points:
A, where expression, put the expression in the row, see whether the expression is true
B, column: Understood as a variable, can be calculated
C, take out the results, can be understood as a temporary table
2.2. Understanding the three-seed query
1. Where sub-query
Consider the result of an inner query as the comparison condition of the outer query
Detail: Select field from table where inner layer result
Execution: Executes the WHERE statement first, resulting in the inner layer. Then execute the outer layer
2. From sub-query
Use the inner query result as a temporary table for the outer SQL to query again
Detail: Select field from (from subquery)
Execution: Executes the FROM after the statement, obtains the inner layer result. Then execute the outer layer
3, exists sub-query
Take the outer query results and get the inner layer. See if the inner query is set up.
This process is the result of the query from the outer layer, one line into the inner layers, to determine whether the establishment. That is, whether the statement after exists is true. If true, displays the line that is being entered. The opposite is not necessary.
The quieter become,the more you is able to hear!
Little shellfish _mysql Three seed query