Home >Database >Mysql Tutorial >About mysql implementation of table join (left, right, inner, full join)
mysql implements table connection (left, right, inner, full join)
The connection between two tables appears in the query. The following uses examples to explain the differences between various connection queries
Table a, and table b are as shown below
a has abcd in the table
## b has abcfin the table
Inner join:SELECT * from a INNER JOIN b on a.name=b.id;The result is as shown in the figure, select the equivalent result (abc) Left join:
SELECT * from a left JOIN b on a.name=b.id;The query results are as shown in the figure, select table a as the benchmark. (abcd) Right join:
SELECT * from a right JOIN b on a.name=b.id;The query results are as shown in the figure, select table a as the benchmark. (abcf) Full join: mysql does not support full join (full join), you can use left join union right join
(SELECT * from a left JOIN b on a.name=b.id) UNION (SELECT * from a RIGHT JOIN b on a.name=b.id );The result is that all are displayed , as shown below: Recommended mysql video tutorial, address:
//m.sbmmt.com/course/list/51.html
The above is the detailed content of About mysql implementation of table join (left, right, inner, full join). For more information, please follow other related articles on the PHP Chinese website!