You are on page 1of 1

10000,20000,40000,50000,70000,10000,10000

order by asc row_number rank dense_rank


10000 1 1 1
10000 2 1 1
10000 3 1 1
20000 4 3 2
40000 5 4 3
50000 6 5 4
70000 7 6 5

====================================================================
how many rows obtained in inner join,left join,right join,full jion
tab1--> 20,30,40,20,null,50,10
tab2-->10,20,30,null,70,80,40

inner join--
(20,20),(30,30),(40,40),(20,20),(10,10) -->5

left join --
5+(null,null),(50,null) -->7

right join--
5+(null,null),(null,70),(null,80)-->8

full join--
5+2+3-->10

Inner Join:

(20, 20), (30, 30), (40, 40), (20, 20), (10, 10)
Number of rows in the inner join: 5
Left Join:

(20, 20), (30, 30), (40, 40), (20, 20), (10, 10), (50, null), (null, null)
Number of rows in the left join: 7
Right Join:

(20, 20), (30, 30), (40, 40), (20, 20), (10, 10), (null, 70), (null, 80)
Number of rows in the right join: 7
Full Join:

(20, 20), (30, 30), (40, 40), (20, 20), (10, 10), (50, null), (null, null), (null,
70), (null, 80)
Number of rows in the full join: 9

You might also like