Find the relation that is UNION compatible with another relation / Union compatibility in Relational Algebra / Set operations compatibility in Relational Algebra
Question:
10. Consider the following relation SAILOR with the given schema;
SAILOR(Sailor_ID:smallint, sailor_name:char(30), DOB:date, Age:int)
(a) SAILR(Sailor_ID:smallint, s_name:char(25), DOB:date, Age:int, Address:varchar(5))
(b) SAILOR2(S_ID:int, s_name:char(30), DOB:date)
(c) SAILOR3(SID:int, s_name:varchar(20), DOB:date, Age:smallint)
(d) All of the above
Answer:
(c) SAILOR3(SID:int, s_name:varchar(20), DOB:date, Age:smallint)
For set operations U, ∩, and - in relational algebra, the following are the properties must be held by both relations on either side of the operator;
1. The arity of the set operation should be same, ie., the number of attributes should be same in both relations.
2. The attributes should be compatible, ie., the first attribute of left side relation (LSR) and the first attribute of right side relation (RSR) should be compatible, the second attribute of LSR and the second attribute of RSR should be compatible, and so on.
These conditions are TRUE only for C while we perform SAILOR U SAILOR3.
The other relations SAILR and SAILOR2 given in options (a) and (b) respectively are not with correct number of attributes. Hence, there is no Union compatibility
No comments:
Post a Comment