Loading Consent Dialog

Diagram Conventions   «Prev  Next»

Lesson 2 The entity-relationship (ER) diagram
ObjectiveDefine the function of an ER diagram.

Purpose of ER Diagram in Data Modeling

An entity-relationship (ER) diagram is a conceptual model that captures an organization's business rules (and any common-sense rules) as concisely as possible. Specific objectives of an ER diagram are to provide:

  1. A unified view of the entities, attributes, and relationships that comprise the overall data structure of the database
  2. A convenient communication tool during database design that enables designers and users of data to view (and review) together the business rules that underlie the overall database structure
  3. A blueprint for generating a relational database using SQL[1]. It provides a set of commands that can be used to add data to a database, retrieve that data, and update it. SQL often pronounced "sequel"; is universally supported by relational database vendors.
  4. Documentation for the duration of the DBLC, serving as a reference should structural changes to the database become necessary
Several types of ER diagrams are available in CASE tools software, all of which function identically.

Value Sets (Domains) of Attributes.

Each simple attribute of an entity type is associated with a value set (or domain of values), which specifies the set of values that may be assigned to that attribute for each individual entity.
In Figure 7-2, if the range of ages allowed for employees is between 16 and 70, we can specify the value set of the Age attribute of EMPLOYEE to be the set of integer numbers between 16 and 70.
Similarly, we can specify the value set for the Name attribute to be the set of strings of alphabetic characters separated by blank characters, and so on. Value sets are not displayed in ER diagrams, and are typically specified using the basic data types available in most programming languages, such as integer, string, Boolean, float, enumerated type, subrange, and so on. Additional data types to represent common database types such as date, time, and other concepts are also employed.

Figure 7-2 : Two entity types, EMPLOYEE and COMPANY, and some member entities of each.

Mathematically, an attribute A of entity set E whose value set is V can be defined as a function from E to the power set[2] P(V) of V:
A : E --> P(V)

We refer to the value of attribute A for entity e as A(e). The previous definition covers both single-valued and multivalued attributes, as well as NULLs. A NULL value is represented by the empty set. For single-valued attributes, A(e) is restricted to being a singleton set for each entity e in E, whereas there is no restriction on multivalued attributes. For a composite attribute[3] A, the value set V is the power set of the Cartesian product of P(V1), P(V2), ... , P(Vn), where V1, V2, ..., Vn are the value sets of the simple component attributes that form A:

V = P (P(V1) × P(V2) × ... × P(Vn))

The value set provides all possible values. Usually only a small number of these values exist in the database at a particular time. Those values represent the data from the current state of the miniworld. They correspond to the data as it actually exists in the miniworld.
The next lesson describes the three best-known examples.
[1]SQL: SQL is an acronym for Structured Query Language
[2] power set: The power set P (V) of a set V is the set of all subsets of V.
[3]composite attribute: An attribute composed of more than one attribute is called a composite attribute.