The last order of business before diving into the creation of an entity-relationship (ER) diagram is to examine how entities relate to one another.
Different aspects of entity relationships,
- the types of relationships that can exist between entities, as well as the
- types of participation entities have in relationships,
find their way into an ER diagram as symbols.
Be forewarned that the lessons in this module may seem a bit more “technical” than previous lessons.
One reason for this is because the guidelines for establishing entity relationships (table links) are couched in the language of conceptual modeling.
In software engineering, an entity relationship model (ER model) is a data model
for describing the data or information aspects of a business domain or its business process that lends itself to ultimately being implemented in a database such as a relational database
The main components of ER models are 1) entities and 2) the relationships that can exist among them.
Variants of the idea existed previously, and have been devised subsequently such as supertype and subtype data entities and commonality relationships
. Furthermore, an entity relationship model
is a systematic way of describing and defining a business process. The process is modeled as components that are linked with each other by relationships that express the dependencies and requirements between them.
Entities may have various attributes that characterize them and diagrams created to represent these entities, attributes, and relationships graphically are called entity relationship diagrams
An ER model is typically implemented as a database. In the case of a relational database, which stores data in tables, every row of each table represents one instance of an entity. Some data fields in these tables point to indexes in other tables and these pointers represent the relationships.
The three schema approach
to software engineering uses three levels of ER models that may be developed.
Once you have a good idea of the basic entities in your database environment, your next task is to identify the relationships among those entities. There are three basic types of relationships that you may encounter:
- one-to-one (1 : 1),
- one-to-many (1 : M), and
- many-to-many (M : N or M : M).
Before examining each type, you should keep one thing in mind: The relationships that are stored in a database are between instances of entities. For example, a customer is related to the items that he or she orders. Each instance of the customer entity is related to instances of the specific items ordered. When we document data relationships, such as when we draw an ER diagram, we show the types of relationships among entities. We are showing the possible relationships that are allowable in the database. Unless we specify that a relationship is mandatory, there is no requirement that every instance of every entity must be involved in every documented relationship.
The next lesson defines entity relationships.