Database collation--Advanced query

Source: Internet
Author: User

# Notes
--Notes

--Advanced query
--Connection Query
SELECT t1. ' Name ', T2. Brand_Name from brand T2,car T1--Cartesian product
WHERE T2. Brand_Code = t1. Brand
--Multi-table connection query
SELECT t1. ' Name ', T2. Brand_name,t3.prod_name
From car t1
Left JOIN brand T2 on T1. Brand = t2. Brand_Code
Left joins Productor T3 on T2. Prod_code = T3. Prod_code
--The number of union query fields must be the same
SELECT ' Name ', price from car
UNION
SELECT Brand_name,brand_memo from Brand
--Sub-query
SELECT * FROM car
WHERE Car.brand in
(SELECT Brand_Code from Brand WHERE prod_code = ' p001 ')

Database collation--Advanced 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.