An entity-relationship diagram is a method of conceptually describing the schema of a database in a human viewable format.
The entities of an entity-relationship diagram describes a "thing" that is capable of an independent existence that can be uniquely identified. An entity is a thing that exists either physically or logically.
An entity may be a physical object such as a house or a car (they exist physically), an event such as a house sale or a car service, or a concept such as a customer transaction or order (they exist logically as a concept).
Entities can typically be thought of as nouns. Examples include a computer, an employee, a song, or a mathematical theorem.
The relationships of an entity-relationship diagram captures how entities are related to each other. Relationships can be thought of as verbs linking two or more nouns.
Examples include an owns relationship between a company and a computer, a supervises relationship between an employee and a department, a performs relationship between an artist and a song, and a proves relationship between a mathematician and a conjecture.
The cardinality of a relationship describes the number of relationships that an entity can participate in. There are generally 4 types of cardinality:
The participation of a relationship describes whether an entity must be involved in that relationship in order to exist. There are generally 2 types of participation:
When designing an entity-relationship diagram, the entities are drawn as squares with their descriptive name (typically a noun) in the centre, these are then connected to the attributes using a line which are drawn as circles with their respective attribute keys in the middle.
Relationships are drawn as a vertical rhombus (resembling a kite) with a descriptive name in the centre (typically a verb) in the centre. These relationships are then linked to their constituting entities.
The lines to relationships can be "plain" or have arrows, these combinations of arrows an plane lines describes the cardinality of the relationship.
Two plane lines indicate a many-to-many relationship
Example of a many-to-many relationship between actors who work on movies.
One plane line and an arrow indicate a one-to-many or a many-to-one relationship
Example of a one-to-many relationship between directors who direct movies.
Two arrows indicate a one-to-one relationship
Example of a one-to-one relationship between a country and their capital.
When an entity requires total participation it's line to the relationship is drawn bolded.
Example of a one-to-many relationship between directors who direct movies, where movies are required to have a relationship to a director.