//内连接
select a.,b.
from tb_orders a,tb_user b
where a.user_id=b.id;
//内连接
select a.,b.
from tb_orders a join tb_user b
where a.user_id=b.id;
//内连接
select a.,b.
from tb_orders a inner join tb_user b
on a.user_id=b.id;
/左连接
select a.,b.
from tb_orders a left join tb_user b
on a.user_id=b.id;
//右连接
select a.,b.
from tb_orders a right join tb_user b
on a.user_id=b.id;
//全连接,不支持full join
select a.,b.
from tb_orders a left join tb_user b
on a.user_id=b.id
UNION
select a.,b.
from tb_orders a right join tb_user b
on a.user_id=b.id ;
//没有外联结,不支持OUTER join
select a.,b.
from tb_orders a OUTER join tb_user b
on a.user_id=b.id ;
内连接(逗号,或者inner join 或者 join)
左连接(也叫左外连接)
右连接(也叫右外连接)
全连接(mysql不支持full join 用union)
需要注意的地方