randy
randy

Reputation: 165

Relational Algebra: Natural join with NULL value

Table 1

Customer  id  city 
John       1   LA
Nancy      2   NULL

Table 2

Customer  $ in the pocket 
John       20
Nancy      30

I am wondering what happen if Table 1 natural join with Table 2? My guess is that the result would be 4 attributes and both John and Nancy will appear.

But my friend told me that only John will appear, Nancy won't because there is a null value.

Upvotes: 1

Views: 5709

Answers (1)

Sonam Gurung
Sonam Gurung

Reputation: 127

In the case above, your friend is wrong, you are right!

Let's see a case where it would be otherwise:

Table 'Customer'

Id Name   AccNo
1  John    44
2  Nancy  NULL 

Table 'Account'

AccNo $_in_Pocket
44       20
45       30

Here, with a natural join, we would get all attributes for John but Nancy would be missing from the results.

Upvotes: 2

Related Questions