1.MySQL JOIN operation
The left join is based on left table and its records are all represented, while the right table shows only the records that meet the search criteria. The right join is based on the table on the left, and its records are all displayed, and only records that meet the search criteria are displayed in the table. The following first creates two tables for testing, table A contains the ID (AID) and the name (AName), and table B contains the ID (BID) and the study number (Bnum).
Figure 1
As you can see, the table was created successfully and several data were inserted. The following test begins with the left and right connections, as shown in result 2.
Figure 2
As can be seen from Figure 2, the left connection is based on table A, a total of 5 records. In the results, table B displays only records with A.aid = B.bid, and unequal places are filled with null. The right connection, based on table B, a total of 4 records. In the result, table A shows only the records that meet the search criteria, and the others are filled with null.
Below, test the inner JOIN operation. An inner join expression means an equal connection, on which the search condition is expressed. Results with no search criteria are shown in result 3 with on.
Figure 3
When using the JOIN operation, note that the on condition requires attention to some things. The difference between the and condition control and where control is shown in 4.
MySQL Learning record One