Select connection query Statement "SQL statement query"

Source: Internet
Author: User
Tags joins

Common select various query formats:

General Query

1. Select * FROM table name

2. Select * FROM table name where column name + condition

Internal connection

3. Select column name, column name from table name 1 inner JOIN table name 1 on table Name 2. column name = table Name 2. Column name ... Two-table connection

4. Select column name, column name from table name 1 inner JOIN table name 1 on table Name 2. column name = table Name 2. column name inner JOIN table name 3 on table Name 2. column name = table name 3. Column name ... Three-table connection

...........

External links

Left outer link:

5. Select column name, column name from table name 1 LEFT OUTER JOIN table name 2 on table name 1. column name = table Name 2. Column Name

Right outer link:

6. Select column name, column name from table name 1 right outer join table name 2 on table name 1. column name = table Name 2. Column Name

Instance:

Select P.productname, s.companyname from products p inner joins suppliers s on p.supplierid = S.supplierid

Select o.orderid,productname,orderdate from Orders o inner joins [order Details] od on O.orderid=od.orderid inner JOIN PROD Ucts p on Od.productid=p.productid

Select connection query Statement "SQL statement 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.