Little shellfish _mysql Three seed query

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.