/  Technology   /  Natural Join Operation, Assignment Operation

Natural Join Operation, Assignment Operation

Natural Join Operation, Assignment Operation

 

Natural Join Operation ( |X| ):

This operation combines one tuple from relation-1 with another tuple from relation-2, only when the common attribute values of both the relations are the same.

 

Consider the following relation :

 

R1 :  STUDR2 : DEPT
SNoSNameDNoDNoDName
21Riya2121CSE
23Priya2122IT
26Zayn2223ECE
28Harry2224ME
30Sia2325EEE

 

Example-1 : Combine the above two relations with the Natural Join operator.

   STUD  |X|   DEPT

 

Output : Here the first tuple in STUD is combined with the first tuple in DEPT.

   There will be a total of 5 tuples and 4 attributes.

 

SNoSNameDNoDName
21Riya21CSE
23Priya22IT
26Zayn23ECE
28Harry24ME
30Sia25EEE

 

Assignment Operation  ( ß ):

 This operation finds the result on RHS and keeps it in LHS.

Example-2 : Execute the following SQL expression for the following table

 

FNoFNameDNoQualSalary
22Riya21Ph.D55000
24Priya22M. Tech50000
25Zayn22M. Tech42000
27Harry23M. Tech28000
30Sia23M. Tech32000
33Max24Ph.D53000
35Fred24Ph.D52000
37Diva25M. Tech26000
39Ben25M. Tech24000
40Trent25M. Tech34000

XXX ß sDNo = 25  (Faculty-1)

 

Output :    XXX

 

FNoFNameDNoQualSalary
37Diva25M. Tech26000
39Ben25M. Tech24000
40Trent25M. Tech34000

 

 

Leave a comment