MySQL subquery subquery

Source: Internet
Author: User

A subquery (subquery) refers to a SELECT clause that appears within other SQL statements.

For example:

SELECT * from t1 where col1= (select col2 from T2);

where select * from T1, called Outer query/outer Statement (outer query)

Select col2 from T2, called subquery (subquery)

The subquery must be nested inside the query and must always appear inside the parentheses

A subquery can contain more than one keyword or condition,

such as the distinct group by order by limit function, etc.

The outer query of a subquery can be a SELECT Insert update set or do

Subquery return value

A subquery can return a scalar, a row, a column, or a subquery.

MySQL subquery subquery

Related Article

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.