Table of SQL Links

Source: Internet
Author: User

Table Links: Join on default preceded by modifier inner
Join within joins A and B tables all depending on the relationship may
The link should be displayed in a way that doesn't matter.

When there is a relationship in the middle of a two table, it needs to be rounded
Synthesize a table to show it
In the select and from the middle of the want to display the direct write up
After from a table splicing join another table on the back
Write the relationship between the two tables
Get the first piece of data in the car table and take the first one.
Data information according to the relationship on the brand table to find the number
According to the docking.

Example:
Show the code name Brand_Name.
Select code, name, Brand,brand_name from
Car
Join Brand on Car.brand=brand
. Brand_Code

Cartesian product: Complete splicing of two of the data to create a capital
SOURCE Waste
Select *from Car,brand where
Car.brand=brand.code to filter

Left join the data on this table shows all the right
On the side of the docking

Example:
Select Code,name,brand, Brand
. Brand_Name from car
Left JOIN Brand on
Car.brand=brand.brand_code


Right of the join shows all the docking to the left
Example:
Select Code,name,brand, Brand
. Brand_Name from car
Right Join Brand on
Car.brand=brand.brand_code


The condition after on is not necessarily the primary foreign key relationship as long as the number
It can be as type as

Table of SQL Links

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.