左连接
select * from <leftTable> left joinr <ightTable> on 匹配条件 [where 条件];
左连接:显示左表中的所有数据,如果在右表中 不存在 匹配数据,则显示为 NULL
右连接
select * from <leftTable> right joinr <ightTable> on 匹配条件 [where 条件];
左连接和右连接的区别:
- 左连接 --- 显示左表中的数据,与右表没有匹配上的则右表的数据显示为null
- 右连接 --- 显示左表中的数据,