1,350 views

1 Answer

Best answer
6 votes
6 votes

Let us make it clear with examples.

Table R :

A B C
4 6 5
7 4 7
8 5 5

Table S:

C D
5 7
6 8

The Simpler explanation goes like:

Step 1: Cartesian product of Table R with Table S. This will look like:

  R * S = 

A B C C D
4 6 5 5 7
4 6 5 6 8
7 4 7 5 7
7 4 7 6 8
8 5 5 5 7
8 5 5 6 8

Step 2: Now select all the rows having Common Column Value same i.e C column value is same in both C columns. 

 table becomes: 

R ⋈ S :

A B C D
4 6 5 7
8 5 5 7

// as C value is same in both columns no need to write separately. 

Now, how to directly Natural Join  R ⋈ S :

Step 1: Check if both table have any Attribute (column name) in common. Here Column = 'C' is common in both R and S.

Step 2: Compare a value of 'C' column from either table (let's say R) with value of 'C' column in other table ( Table S ) and check where is that value in other table. 

Step 3: Once a match occurs. Join both Rows keeping common column name occurring only once. // 'C' should be kept once.

selected by

Related questions

1 votes
1 votes
1 answer
2
learner_geek asked Jan 24, 2018
1,259 views
My answer is not matching with any of the option.so what is the correct answer
2 votes
2 votes
1 answer
4
rahul sharma 5 asked Jan 5, 2017
976 views
Say I have two tables and they have some attributes in common, assume x is common, now will x will appear once in the output or twice for following cases? Natural joinCro...