--内连接 两种写法 等值连接
select r.*,b.bummc from t_hq_ryxx r, t_hq_bm b where r.bumbm = b.bumbm
select r.*,b.bummc from t_hq_ryxx r inner join t_hq_bm b on r.bumbm = b.bumbm
--不等值连接
select r.*,b.bummc from t_hq_ryxx r, t_hq_bm b where r.bumbm > b.bumbm
select r.*,b.bummc from t_hq_ryxx r inner join t_hq_bm b on r.bumbm < b.bumbm
--自连接
select * from t_hq_ryxx a, t_hq_ryxx b where a.bumbm = b.bumbm
--外连接 左连接 保证左侧表信息完整性
select r.*,b.bummc from t_hq_ryxx r left join t_hq_bm b on r.bumbm = b.bumbm
-- 右连接 保证右侧表信息完整性
select r.*,b.bummc from t_hq_ryxx r right join t_hq_bm b on r.bumbm = b.bumbm
--全连接 保证两侧表信息的完整性
select r.*,b.bummc from t_hq_ryxx r full join t_hq_bm b on r.bumbm = b.bumbm
时间: 2024-10-08 21:34:16