Home > Database > Mysql Tutorial > What is the way to write Chinese and foreign connections in mysql?

What is the way to write Chinese and foreign connections in mysql?

青灯夜游
Release: 2020-10-19 14:23:51
Original
4350 people have browsed it

mysql Chinese and foreign joins can be divided into left outer joins and right outer joins. The writing methods are "SELECT field name FROM table 1 LEFT OUTER JOIN table 2 ON clause" and "SELECT field name FROM table 1 RIGHT OUTER JOIN" Table 2 ON clause".

What is the way to write Chinese and foreign connections in mysql?

(Recommended tutorial: mysql video tutorial)

Outer joins can be divided into left outer joins and right outer joins

  • Left outer join: Contains all rows in the left table (regardless of whether there are matching rows in the right table), and all matching rows in the right table

  • Right outer join: Contains all rows in the right table (regardless of whether there are matching rows in the left table), and all matching rows in the left table

Left join

Left outer join, also known as left join, uses the LEFT OUTER JOIN keyword to connect two tables, and uses the ON clause to set the connection condition.

The syntax format of left join is as follows:

SELECT <字段名> FROM <表1> LEFT OUTER JOIN <表2> <ON子句>
Copy after login

The syntax description is as follows: