Here are two tables
Table Stu
Table Tech
1. Right connection
When using the RIGHT JOIN statement query, the results are as follows:
1 SELECT stu.id,stu.name,stu.classe_name,tech.id,tech.name from Stu right JOIN tech on Stu.classe_name=tech.classe_name ;
As you can see from the results, the fields that are queried in the tech table are all displayed, and in the Stu table, only the corresponding fields of the same entries as the table Tech's classe_name will be displayed.
Right connection: Returns all fields in the right table that match the criteria in the table on the left.
2. Left connection
When querying with a left connection statement, the result is as follows:
1 SELECT stu.id,stu.name,stu.classe_name,tech.id,tech.name from Stu left JOIN Tech on Stu.classe_name=tech.classe_name;
As you can see from the results, the fields that are queried in the Stu table are all displayed, and in the tech table, only the corresponding fields of the same entries as the table Stu Classe_name are displayed.
Left join: Returns all fields in the left table that match the criteria in the table to the right.
3. Internal connection
When querying with an inner JOIN statement, the result is as follows:
1 SELECT stu.id,stu.name,stu.classe_name,tech.id,tech.name from Stu INNER JOIN Tech on Stu.classe_name=tech.classe_name ;
MySQL left connection right connection inner connection-example (GO)