relationshiperd

Do Entity-Relationship diagrams need attributes to represent relationships?


I'm designing an ERD for an assignment. The brief will contain relationships, such as "Every employee is assigned to a single department".

I could add a field in the entity: "Assigned Department". But with what I've seen so far across sources, this is hit or miss. Some sources do this. Some prefer to leave it out, instead adding a textual label "assigned to" to the line connecting the two entities.

Is there any guidance on this? I'm going to normalise this later, so if this is a normalisation step rather than an ERD step I'd like to preferably do it when normalising.


Solution

  • You can provide information as an attribute (field), for example Name of an Employee or Id of a Department.

    But in ERD, this would mean that:

    As a hint, as soon as a relationship is expressed, with cardinality constraints or mandatory vs. optional participation, it'd be safer to consider making it an entity.

    Edit: the attribute in addition to the entity?

    If you anyway have the Department entity and the relationship, the question is whether your ERD is a conceptual model documenting your domain, or if it is a physical model documenting your implementation.

    Physical models show all the tables with all the fields required to implement the relationships. The relationships are then only visual aids.

    Conceptual models focus on the domain's entities and their relationships, independently of the db implementation. Here, you should better not add the attribute: