databaseentity-relationshiperd

How to represent optional attributes in an ER diagram?


I know you can do the line/circle notation, but our lecture says we're not supposed to use those attributes. We're supposed to find a better solution. I've been reading the recommended database book, but the author DOES use the notation..? He doesn't seem to present an alternative.


Solution

  • Optional attributes can be represented with a dotted line connection to their respective entity.

    From the Wikia:

    A required attribute is an attribute that must have a value in it, while an optional attribute may not have a value in it and can be left blank. The reasoning for making an attribute required is to ensure that data are collected for that particular characteristic.

    Example: Consider the entity Student abovestud_LastName and studFirstName would be required attributes as it uniquely defines that table and we assume all students have a first and last name. Optional attributes in the table Student could be stu_MiddleName, stu_Email, and stu_Phone since some students may not have a middle name, a phone number, or an email address

    For example:

    optional attribute diagram