Mysql three-seed query: I. three seed query II. three seed query comprehension Model I. mysql three seed query where subquery, from subquery, and exists subquery II. Understanding model: 21. a good model for us to understand. When we write an SQL statement
MysqlTri-seed query
Brief:
Seed 1 and 3
II. seed query comprehension model
I. mysql three-seed query
Where subquery, from subquery, and exists subquery
II. Understanding the model:
2.1. a good model for us to understand. When writing an SQL statement, you can understand the following points:
A. where expression. Place the expression in the row to check whether the expression is true.
B. column: It is considered a variable and can be computed.
C. The result can be understood as a temporary table.
2.2. understand the three-seed query
1. where subquery
Consider the result of the inner query as a comparison condition of the outer query.
Detailed: select field from table where inner result
Run: run the where statement first to obtain the result of the inner layer. Execute outer layer
2. from subquery
Use the internal query result as a temporary table for the outer SQL to query again
Details: select field from (from subquery)
Run: execute the from statement first to obtain the inner result. Execute outer layer
3. exists subquery
Obtain the outer query result to the inner layer. Check whether the query on the inner layer is true.
This process is based on the query result to the outer layer, and a row is substituted into the inner layer to determine whether the result is true or not. That is, whether the statement after exists is true. If it is true, this line is displayed. Otherwise, no.