CReate table A(Code varchar(50), emp_no varchar(50))
Insert into A values ('101',12222)
Insert into A values ('102',23333)
Insert into A values ('103',34444)
Insert into A values ('104',45555)
Insert into A values ('105',56666)
CReate table B(Code varchar(50), City varchar(50), Country varchar(50))
Insert into B values ('101','Mumbai', 'India')
Insert into B values ('101','Delhi', 'India')
Insert into B values ('101','Hyderabad', 'India')
Insert into B values ('102','Chennai', 'India')
Insert into B values ('103','Kolkata', 'India')
Select * From A;
Select * From B;
Select * From A Inner Join B On A.Code = B.Code; -- Total Rows (5) => 1(3),2,3
Select * From A Left Join B On A.Code = B.Code; -- Total Rows (7) => 1(3),2,3,4,5
Select * From A Right Join B On A.Code = B.Code; -- Total Rows (5) => 1(3),2,3
Select * From A Cross Join B; -- Total Rows (5) => 1 to all (Repeat)
Insert into A values ('101',12222)
Insert into A values ('102',23333)
Insert into A values ('103',34444)
Insert into A values ('104',45555)
Insert into A values ('105',56666)
CReate table B(Code varchar(50), City varchar(50), Country varchar(50))
Insert into B values ('101','Mumbai', 'India')
Insert into B values ('101','Delhi', 'India')
Insert into B values ('101','Hyderabad', 'India')
Insert into B values ('102','Chennai', 'India')
Insert into B values ('103','Kolkata', 'India')
Select * From A;
Select * From B;
Select * From A Inner Join B On A.Code = B.Code; -- Total Rows (5) => 1(3),2,3
Select * From A Left Join B On A.Code = B.Code; -- Total Rows (7) => 1(3),2,3,4,5
Select * From A Right Join B On A.Code = B.Code; -- Total Rows (5) => 1(3),2,3
Select * From A Cross Join B; -- Total Rows (5) => 1 to all (Repeat)