'How do i join on null in two table in sql? inner join, left,right,full n cross join -- Interview Question Tech Mahindra
Create table TechM ( id int ) ;
select * from TechM
insert into TechM values (1),
(1),
(1),
(2),
(3),
(null)
;
Create table TechN ( id int ) ;
select * from TechN
insert into TechN values (1),
(1),
(2),
(2),
(2),
(2),
(null),
(4),
(5),
(null)
;
Solution 1:[1]
Each NULL is considered to be a different value, So In this case count will be as below
Left join -- 12
Right join -- 14
Full join --16
Cross join -- t1*t2 = 6*10 = 60
you can see the count/query on below link in detail : check here
These type of question is commonly asked in interview.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | DB08 |