in Databases
687 views
0 votes
0 votes

 

Referencing to this gate ques- https://gateoverflow.in/16095/gate2004_13-let-and-two-relation-schema-where-the-primary-key

Let R1 (A, B, C) and R2 (D, E) be two relation schema, where the primary keys are shown underlined, and let C be a foreign key in R1 referring to R2. Suppose there is no violation of the above referential integrity constraint in the corresponding relation instances r1 and r2. 

how does projection (r1) - projection (r2)  we will get empty relation?

For referential integrity to hold in a relational database, any column in a base table that is declared a foreign key can contain either a null value, or only values from a parent table's primary key or a candidate key. 

So C can  have null or duplicate values in foreign key, subtracting entities of D from C can still have null and other values(those were duplicate). So, how will it get empty set?

 

in Databases
687 views

3 Comments

Projection removes the duplicates right?

Also, why will we consider null as an element in the projection? If any element is NULL in C then we don't need to bother about it..
0
0

if C has NULL in it then the query projection (r1) - projection (r2) will be a set containing null which isn't empty set . Hence the answer would be wrong.

 

0
0
@MiNiPanda
0
0

Please log in or register to answer this question.