select * from mytable;----基本表
select * from myusertest;----基本表
---Oracle 左连接 以左边表为主表,即右边的表数据可以为空,但左边的表数据记录全部显示出来
select t1.*,t2.pro_name,t2.score from mytable t1,myusertest t2
where t1.user_id = t2.user_id(+);--左连接
--左连接与上面左连接语句等价
select t1.*,t2.pro_name,t2.score from mytable t1 left join myusertest t2 on t1.user_id=t2.user_id;
--Oracle 右连接 以右边表为主表,即右边的表数据可以为空,但右边的表数据记录全部显示出来
select t1.*,t2.pro_name,t2.score from mytable t1,myusertest t2
where t1.user_id(+) = t2.user_id;
--右连接与上面右连接语句等价
select t1.*,t2.pro_name,t2.score from mytable t1 right join myusertest t2 on t1.user_id=t2.user_id;
--Oracle全等连接--inner join等价 全等连接也叫自然连接
select t1.*,t2.pro_name,t2.score from mytable t1,myusertest t2
where t1.user_id = t2.user_id;
--与内部连接等价
select t1.*,t2.pro_name,t2.score from mytable t1 inner join myusertest t2 on t1.user_id=t2.user_id;