Professional Documents
Culture Documents
Entity Relationship (ER) Diagrams
Entity Relationship (ER) Diagrams
Diagrams
Design Phases
The initial phase of database design is to characterize fully the data
needs of the prospective database users.
Next, the designer chooses a data model and, by applying the
concepts of the chosen data model, translates these requirements into
a conceptual schema of the database.
A fully developed conceptual schema also indicates the functional
requirements of the enterprise. In a “specification of functional
requirements”, users describe the kinds of operations (or transactions)
that will be performed on the data.
Design Phases (Cont.)
Attribute types:
Simple and composite attributes.
Single-valued and multivalued attributes
Example: multivalued attribute: phone_numbers
Derived attributes
Can be computed from other attributes
Example: age, given date_of_birth
Domain – the set of permitted values for each attribute
Composite Attributes
Redundant Attributes
Suppose we have entity sets:
instructor, with attributes: ID, name, dept_name, salary
department, with attributes: dept_name, building, budget
We model the fact that each instructor has an associated
department using a relationship set inst_dept
The attribute dept_name appears in both entity sets. Since
it is the primary key for the entity set department, it
replicates information present in the relationship and is
therefore redundant in the entity set instructor and needs to
be removed.
BUT: when converting back to tables, in some cases the
attribute gets reintroduced, as we will see later.
E-R Diagrams
Figure 3.14 Summary of ER diagram notation
Entity Sets
Entities can be represented graphically as follows:
• Rectangles represent entity sets.
• Attributes listed inside entity rectangle
• Underline indicates primary key attributes
Relationship Sets
Employees
name
ssn lot
since
name dname
Employees
ssn lot did budget
super- subor-
visor dinate
Employees Works_In Departments
Reports_To
since
name dname
ssn lot did budget
0,M 1,M
Employees Manages Departments
1,1 1,M
Works_In
since
Starting an ERD
1. Define the Entities.
2. Define the Relationships.
3. Add attributes to the relationships.
4. Add cardinality to the relationships.
5. Don’t forget to use proper naming conventions and symbol
representation.
Entity Types
(Naming Guidelines)
Entity type name should be:
A singular noun and in capital letters.
Descriptive and specific to the organization.
Concise.
Named for the result of the event, not the activity or process of
the event.
Entity Types
(Defining Guidelines)
An Entity type definition should:
Include a statement of what the unique characteristics are for each
instance.
Make clear what entity instances are included and not included.
Include a description of when an instance of the entity type is
created and deleted.
Specify when an instance might change into an instance of
another entity type.
Specify what history is to be kept about entity instances.
Attributes
(Naming Guidelines)
An attribute name:
Should be a noun and capitalize the first letter of each word.
(Example: Student_ID.)
Should be unique.
Should follow a standard format. (Example: Student_GPA, not
GPA_of_Student.)
Similar attributes of different entity types should use similar but
distinguished names.
Example: Faculty_Residence_City_Name and
Student_Residence_City_Name
Attributes
(Defining Guidelines)
An attribute definition should:
State what the attribute is and why it is important.
Make clear what is and isn’t included in the attribute's value.
Define any aliases.
Indicate if the attribute is required or not.
Indicate any relationships with other attributes.
Relationships
(Naming Guidelines)
A relationship definition should Explain:
What action is being taken and why it is important.
If there is any optional participation.
The history that is kept in the relationship.
What any restrictions on participation in the relationship.
For example: An EMPLOYEE may only be able to participate
in two PROJECTS.