Saif
Saif

Reputation: 1905

Defining weak relationship in Entity relationship model

While creating Entity relationship model, I came up with a confusion:

here is an example of two entities:

company (comp_id(pk), comp_name)

topCompanies (rank(pk), comp_id(fk)) *contains a list of top ten or hundred companies

it's not a specialization example as entity topCompanies can't exist on its own, it just contains all comp_id(s) which are in say top ten or hundred. so it means that topCompanies is a weak entity as it can't exist on its own. Now can they have an 'is a' relationship or 'is a' relationship is only limited to inheritance/specialization examples? If no then how should I describe their relationship?

Also, is there any conventions while reading ERD? left-to-right / right-to-left?

Upvotes: 0

Views: 3084

Answers (2)

reaanb
reaanb

Reputation: 10085

First of all, let's get the terminology straight. Entities and tables aren't the same thing. Tables (physical model) represent relations (logical model) which in ER (conceptual model) is separated into entity relations and relationship relations, which record facts about entity sets and relationship sets, respectively.

The company entity set is represented by the column comp_id in both tables. The company relation/table associates the company entity set (via its identifier/key) with a value set of names. The topCompanies relation/table associates the company entity set (via its identifier/key) with a rank.

Is the rank an entity set or a value set? ER generally demands that any set that determines a relation be an entity set, so let's say there's an entity set called ranking, identified and represented by the rank column. This ranking entity set has a relationship with the company entity set, which is what we see in the topCompanies table.

Thus, topCompanies is neither a weak entity nor a subtype of company. A weak entity set is identified by its parent entity set's key together with a local distinguishing attribute. A subtype entity set is identified by the same key as the supertype. However, the topCompanies relation/table doesn't depend on the comp_id at all. Rather, comp_id depends on the rank.

Here's an entity-relationship diagram that depicts it:

top companies ER diagram

Upvotes: 1

Bassam
Bassam

Reputation: 146

topCompany is a subset of Company. You got the relationship right. topCompany is a Company

so a topCompany has a foreign key that points to a Company. It's not weak since it has a primary key (the rank).

Upvotes: 0

Related Questions