Home > Database > Mysql Tutorial > What are the connection queries for mysql tables?

What are the connection queries for mysql tables?

青灯夜游
Release: 2020-10-19 17:35:15
Original
6100 people have browsed it

The connection queries for mysql tables include: 1. Cross connection, which is generally used to return the Cartesian product of the connected table; 2. Inner join, which mainly removes certain parts of the query results by setting connection conditions. Cross-connection of data rows; 3. Outer connection, first divide the connected table into a base table and a reference table, and then return records that meet and do not meet the conditions based on the base table.

What are the connection queries for mysql tables?

(Recommended tutorial: mysql video tutorial)

In a relational database, the relationship between tables is There is a relationship, so in practical applications, multi-table queries are often used. Multi-table query is to query two or more tables at the same time.

In MySQL, multi-table queries mainly include cross joins, inner joins and outer joins.

Cross join

Cross join (CROSS JOIN) is generally used to return the Cartesian product of the join table.

The syntax format of cross-connection is as follows:

SELECT <字段名> FROM <表1> CROSS JOIN <表2> [WHERE子句]
Copy after login

or

SELECT <字段名> FROM <表1>, <表2> [WHERE子句]
Copy after login

The syntax description is as follows: