ERD 3 tables in 1 relationship

12,615

If schedule is a relationship, it would be represented as follows on an entity-relationship diagram:

Schedule as a relationship - ER diagram

Relationships are identified by the keys of the related entities. A table diagram makes this more visible:

Schedule as a relationship - table diagram

However, if schedule is an entity set with relationships to the other 3 entity sets, it would be represented as follows on an ER diagram:

Schedule as an entity set - ER diagram

If we map every entity set and relationship to its own table, we get the following table diagram:

Schedule as an entity set - table diagram

However, if we denormalize the relationship tables into the schedule table (since they all have the same primary key), our table diagram changes to:

Schedule as an entity set - denormalized table diagram

Compare this with the first table diagram. While these physical models are very similar, they derive from very different conceptual models. Strictly speaking, I think both "entity table" and "relationship table" are inappropriate for the denormalized schedule table. In the network data model, we would call it an associative entity (but that's not the same as associative entities in the ER model).

Finally, relationships can have attributes too:

Relationship attribute - ER diagram

Relationship attribute - table diagram

Share:
12,615
Dizz
Author by

Dizz

Updated on June 06, 2022

Comments

  • Dizz
    Dizz almost 2 years

    i am having a hard time creating an ERD for my table relationship. I have 4 tables: film, ticket_type, studio, and schedule. The schedule table is a relationship table that contain the primary key from the other three tables as foreign key. The question is how can i picture it in ERD? Something like many-to-many relationship but with 3 table, is it possible to do it like this? The database works fine when i try to create it so i think there's​ no problem in my concept. Thanks in advance.

    Edit: forgot to add the ticket_type table is for pricing and type like: 2d,3d,or 4d, i create it like this to avoid redundancy. One more question, can i add another field to a relationship table? If I remember correctly it should be fine, but just to make sure.