MySQL connection query

Source: Internet
Author: User
Tags joins

Multi-Table query: (data collection in multiple tables into a table)

SELECT user_name as ' nickname ', Gname as ' game name ', score as ' fraction '

From Users,games,scores

WHERE USERS. User_qq=scores. User_qq

and games. Gno=score. GNO

Connection query: internal and external connections

Inner Connection: The two tables connected are equal, if the contents of the two tables do not correspond then do not connect.

Implicit inner joins: Multiple table names appear directly after the from.

Explicit intra-connection: Seclet user_name from TABLE1 [INNER] JOIN TABLE2 on TABLE1. Col=table2. COL (faster than implicit intra-connection execution)

Outer joins: Left Outer and right outer joins (LETF | Right[outer])

The data in the underlying table must appear, and no data in the other table is represented by a null value.

First appears as the left table, and then appears as the right table.

Seclet User_name,gno,score

From the users left JOIN SCORES on USERS. User_qq=scores. USER_QQ and Gno=5

MySQL connection 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.