Sql--mysql Advanced Query 2

Source: Internet
Author: User

Statement: The material used in this column is written by the VIP students of the Kay Academy, who has the right to be anonymous and has the final right to interpret the article; The Edith Academy is designed to promote students to learn from each other on the basis of public notes.

MySQL Advanced query 2

The Select Advanced query also has the following syntax, fuzzy query like, subquery, recordset merge union.

Fuzzy query like has the following three symbols%,_,[]. The syntax is as follows:

% represents any number, any character. For example:

SELECT * from Shaicheng WHERE username like '% ';

SELECT * from Shaicheng where username like '% ';

_ represents any single character. The syntax is as follows:

SELECT * from Shaicheng WHERE GROUPNAME like ' _ Shi ';

SELECT * from Shaicheng WHERE changci like ' __ field ';

[AB] can choose one character.

The subquery syntax is as follows:

If there are two combined tables,

If you are a relational operator, the result of a subquery can be only one (single-row). If you want to judge a long line of values, there is in. The in syntax is as follows:

The recordset Merge union syntax is as follows:

The queried column names are displayed according to the column names of the first table. The null query syntax is as follows:

The sort and condition can be written on the last query statement:

Sql--mysql Advanced Query 2

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.