Learning to use SQLite (version 3.7.4) (medium D)

Source: Internet
Author: User

Name and alias:

 

 

F is the alias of foods and T is the alias of foods_types. Aliases make table and self-join possible.

 

 

Here, we want to find out which season has mentioned the food with Season 4 in. (For details, see SQLite authoritative guide (Chinese version 2) page 85 );

 

Subquery:

 

In fact, in foods, the real form should be like this:

 

 

 

Remember to rename the subquery in the from clause. As a link source, the subquery in the from clause is often called an inline view or a derived table:

 

 

Subqueries are widely used. When using subqueries, you must constantly use them in different locations to see the results.

 

Compound query:

 

Composite query processes query results using three special Relational operators: Union, cross join, and difference set. The keywords are union, intersect, and except T. During the query, the number of related fields must be consistent. Only one order by statement can be used, which is at the end of a composite query. The composite query relationship is processed from left to right.

 

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.