INNER JOIN:
select *
from hubotao_test1 a INNER JOIN hubotao_test2 b
on a.`name` = b.`name`
LEFT JOIN :左表为基础
SELECT a.`name`,b.`name`
from hubotao_test1 a LEFT JOIN hubotao_test2 b
on a.`name` = b.`name`
where b.name = 'hubotao1'
RIGHT JOIN:右表为基础
select a.password,b.`password`
from hubotao_test1 a RIGHT JOIN hubotao_test2 b
on a.`name` = b.`name`;
FULL JOIN
select *
from hubotao_test1 a FULL JOIN hubotao_test2 b
on a.name = b.name
--MYSQL没有全连接!
[Err] 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FULL JOIN hubotao_test2 b
on a.name = b.name' at line 2
--为了代替全链接
select *
from hubotao_test1 a LEFT JOIN hubotao_test2 b
on a.name = b.name
UNION ALL
select *
from hubotao_test1 a RIGHT JOIN hubotao_test2 b
on a.name = b.name
CROSS JOIN:笛卡儿积
select * from hubotao_test1 a CROSS JOIN hubotao_test2 b