Similarly the Married relation can be added as attributes to PersonChildMother and PersonMother (or the corresponding father relations).
(c) For the Person relation at least one of husband and wife attributes will be null.
Person(personName,personAddress,fatherName,fatherAddress,motherName,motherAddresss,wifeName,wifeAddresss,husbandName,husbandAddress)
ChildOf(personName,personAddress,childName,childAddress)
4.6.3 (a)
People(name,fatherName,motherName) Males(name) Females(name) Fathers(name) Mothers(name)
ChildOf(personName,childName) (b)
People(name)
PeopleMale(name)
PeopleMaleFathers(name) PeopleFemale(name)
PeopleFemaleMothers(name)
ChildOf(personName,childName) FatherOf(childName,fatherName) MotherOf(childName,motherName)
People cannot belong to both male and female branch of the ER diagram.
Moreover since an entity belongs to one and only one class when using object-oriented approach, no entity belongs to People relation.
Again we could replace MotherOf and FatherOf relations by adding as attributes to PeopleMale,PeopleMaleFathers,PeopleFemale, and PeopleFemaleMothers relations. (c)
People(name,fatherName,motherName) ChildOf(personName,childName)
4.6.4 (a)
Each entity set results in one relation. Thus both the minimum and maximum number of relations is e.
The root relation has a attributes including k keys. Thus the minimum number of attributes is a. All other relations include the k keys from root along with their a attributes. Thus the maximum number of attributes is a+k.
(b)
The relation for root will have a attributes. The relation representing the whole tree will have e*a attributes.
The number of relations will depend on the shape of the tree. A tree of e
entities where only one child exists(say left child only) would have the minimum number of relations. Thus below figure will only contain 4 subtrees that contain root E1,E1E2,E1E2E3, and E1E2E3E4. With e entity sets, minimum e relations are
possible.
The maximum number of subtrees result when all the entities(except root) are at depth 1. Thus below figure will contain 8 subtrees that contain root
E1,E1E2,E1E3,E1E4,E1E2E3,E1E3E4,E1E2E4,and E1E2E3E4. With e entity sets, maximum
2^(e-1) relations are possible. (c)
The nulls method always results in one relation and contains attributes from all e entities i.e. e*a attributes.
Summarizing for a,b, and c above;
#Components #Relations Min Max Min Max Method
straight-E/R a a e e
object-oriented a e*a e 2^(e-1) nulls e*a e*a 1 1
4.7.1
4.7.2 a)
b)
c)