Example:
Consider the following relations:
ROLLNO
|
NAME
|
ADDRESS
|
COURSE_ID
|
100
|
Kanupriya
|
234, Saraswati Vihar.
|
CS1
|
101
|
Rajni Bala
|
120, Vasant Kunj
|
CS2
|
102
|
Arpita Gupta
|
75, SRM Apartments.
|
CS4
|
|
|
STUDENT
Course
COURSE ID
|
COURSE_NAME
|
DURATION
|
CS1
CS1
|
BCA
|
3yrs
|
CS2
|
MCA
|
3yrs
|
CS3
|
M.Sc.
|
2yrs
|
CS4
|
B.Sc.
|
3yrs
|
CS5
|
MBA
|
2yrs
|
If we want to show name of all the students with their course details then natural join is used in the following method:
STUDENT COURSE
Resultant relation will be as follows:
If R2 R3= R1 ÷ R2 If R2 R3= R1 ÷ R2
|
Student
ROLLNO
|
NAME
|
ADDRESS
|
COURSE_ID
|
COURSE_NAME
|
DURATION
|
100
|
Kanupriya
|
234, Saraswati
Vihar.
|
CS1
|
BCA
|
3yrs
|
101
|
Rajni Bala
|
120, Vasant Kunj
|
CS2
|
MCA
|
3yrs
|
102
|
Arpita
Gupta
|
75, SRM
Apartments.
|
CS4
|
B.Sc.
|
3yrs
|
There are some other types of joins like outer joins.