About join
Left Join ,Right Join ,Inner join
Join queries is the main query style in relational database
1.Inner join is based on the total value of the column to each table match their rows.
2.Left Join is based on all rows of the left table, not just the ones in which the joined columns match.
3.Right Join is based on all rows of the left table, not just the ones in which the joined columns match.
example:
1.
table stu:
id name age
1 'wang' 20
2 'li' 21
4 'liu' 22
5 'yang' 22
6 'lu' 22
table mark:
id mark stuid
1 61 2
2 44 2
3 66 3
2.
Inner join result:
select s.name,m.mark from stu s , mark m wheres.id=m.stuid;
NAME
--------------------------------------------------------------------------------
MARK
----------
li 44
li 61
Right Join result:
select s.name,m.mark from stu s , mark m wheres.id(+)=m.stuid;
NAME
--------------------------------------------------------------------------------
MARK
----------
li 44
li 61
66
Left Join result:
select s.name,m.mark from stu s , mark m wheres.id=m.stuid(+);
NAME
--------------------------------------------------------------------------------
MARK
----------
li 61
li 44
lu
NAME
--------------------------------------------------------------------------------
MARK
----------
yang
liu
wang
if the left table row has no matching row in the right table or the right table row has no matching row in the left table,the result is null.