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.
(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子句]
or
SELECT <字段名> FROM <表1>, <表2> [WHERE子句]
The syntax description is as follows:
Field name: what needs to be queried Field Name.