简体   繁体   中英

In the EER(Extended ER Diagram), can entity have more than one subclasses?

In the question I'm doing at the moment gave two confusing sentences:

1. A property can be either be a house or an apartment. For a house it records ..bula bula
   For an apartment, it records .. bula bula

2. A property can be either for sale or rent, or for both. If a property is for sale, it 
   records .. bula bula. If the property is for rent, it records .. bula bula

These two are in the same question. Do I have to represent it by using subclasses or how?

Many thanks.

Yes, a entity can have multiple subclasses and multiple superclasses. Both faculty staff and student assistants may be subclasses of employees, and a student assistant may be a subclass of both employees and students.

You can create a Property entity with four subclasses, House, Appartment, PropertyForRent and PropertyForSale.

A property may not be both a house and an appartment. Therefore, use a circle with a d in it to indicate that it is disjoint. A property may be both for rent and for sale. Use a circle with an o in it to indicate that it may overlap.

EER图中的不相交关系

This is described on page 443 in Advanced Data Modelling , and another example can be found on page 30 of this presentation .

Sjoerd's answer is correct.

ER modeling tells you how to diagram subclasses, but it doesn't tell you how to implement them. Nor should it.

If you are interested in designing SQL tables that implement subclasses, look up these topics, or their tags in SO:

Single Table Inheritance
Class Table Inheritance
Shared Primary Key

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM