You are on page 1of 8

Entity-Relationship Terms and Definitions

Entity - Relationship Modeling: The development of a description of a database structure that


is independent of the database management system, meaning that it defines the "information
contents" rather than the "storage structure".
Schema: A description of a portion of reality using a specific data model. The schema is a static,
time-invariant collection of linguistic or graphic representations that describe the structure of the
data of interest.
Abstractions: A mental process used to select some entities, attributes and relations and exclude
others (with respect to a set of objectives).
Chen notation: Developed in 1973 and most useful for conceptual modeling.
Crows Foot notation: Favors a more relational database implementation and can be drawn with
Visio.
Entity: Classes of real-world objects that are of interest to the end user. In Chen notation an
entity is represented as a rectangle and is given a simple and meaningful name.
Attributes: Elementary properties of entities. In Chen notation attributes are listed on a line
below the entity.
1. Let's work with a common, ordinary compact disk (CD) that may have something(s)
recorded on it: List the possible attributes for our CD.

2. A CD with a case is manufactured from many parts. Define an attribute for each of the
component parts and aggregate them to produce the entity Compact Disk.

3. Now, lets look at a DVD at a video rental outlet, e.g. Redbox. What attributes would we use
to classify the DVDs in their collection? Identify the field type (e.g. numeric, text, date) for
each. Include an example of an instance for our Movie DVD entity. Note: Field type is an
example of metadata, i.e. data about data, in this case the field type. In Access the field type
is defined for each attribute in each table during development.

4. Varieties of attributes: Identify an example of each from Movie DVD.

Single valued attribute: Smallest data item that makes sense

Composite attribute: An attribute that is composed of 2 or more components that could be


stored as individual attributes or combined into one, e.g. Name may have the components
FName and LName. We are, in effect, delaying the decision to combine or separate.

Multi-Valued Attribute: May have more than one value per instance of the entity.

Derived Attribute: An attribute whose value can be calculated from other attributes/data.

Key Attribute: A non-null attribute whose value is unique for each instance in the entity for the
entire database. Each entity must have a key attribute.
Candidate key: An attribute that meets the requirements to be a key attribute.
Composite key: Combination of 2 or more attributes that, when combined, meet the
requirements to be a key attribute.
Requirement that the key be minimum.
Use the entity Movie DVD and brainstorm candidate keys, single and composite keys, and
discuss the pros and cons. Why use sequentially assigned ID numbers such as SID?

Entity Relationship Model


Relationships: Represents the mapping of two entities. In Chen notation the symbol for a
Relationship is a diamond containing a descriptive name of the relationship.
What about the representation of a Student and the High School that they attended?
Student - HAS ATTENDED - High School
The entity Student can have attributes such as SSN, name and address. The entity High School
may include an ID #, name and address. We map Student and High School together with the
relationship HAS ATTENDED
Cardinalities
Minimum Cardinality: The minimum number of mappings each element (instance) an entity can
participate in the relationship. Context is critical, for example, would we have an instance of
Student who didnt attend a high school?
Maximum Cardinality: The maximum number of mappings for each element (instance) in an
entity that can participate in the relationship. It is possible for a student to have attended many
high schools but he/she can graduate from only one. Since the exact maximum number is
unknown, we represent it with n.
What would the cardinalities be on the Student side of the relationship assuming that each
Student attended high school?
What about the High School side?
Determine the cardinalities for: Student GRADUATED FROM High School
Alternate representation
Why not represent High School Attended as an attribute of Student?
What are the advantages and disadvantages of each representation?
Multi-valued attribute: Use this when High School is just another descriptive attribute and there
is little interest in determining, for example, how many students attended a specific High School.
One disadvantage is that attributes of High School, e.g. Name, are duplicated when many
students have attended the same high school. Also, the same high school may be identified by
different names, e.g. Corvallis HS, Corvallis High, CHS.
Relationship: Interest in a specific high school may extend beyond the HAS ATTENDED
relationship. This way, high school attributes like address are recorded only once.

E R diagram
How would you represent high schools attended as a multi-valued attribute of Student? How
would you represent high school as a separate entity linked to Student by a relationship? Sketch
the two alternate E R diagrams.

Attributes associated with a Relationship


Some attributes exist only when there is a relationship between entities, e.g.
Student - HAS ATTENDED - High School
Each entity has its own attributes. However, the attribute Last Date Attended exists only when
there is a specific instance of a student attending a high school. It is not part of either entity; only
when an instance in Student is related to an instance in High School. Draw the E R diagram.

Examples
Determine the minimum and maximum cardinality for the following entity relationship entity
mappings. Explain your reasoning and assumptions.
1. Library Patron - CURRENTLY BORROWING - Book

2. Library Patron - HAS BORROWED - Book

3. Customer - WRITES A - Purchase Order

4. Purchase Order - IS FOR - Part

6. Nurse - ASSIGNED TO - Hospital Patient

7. Hospital Patient - ASSIGNED TO - Bed

Generalizations
Generalization abstraction: The process of defining a top-level class subclass relationship
that exists between two or more entities. In a generalization the top-level class inherits the
attributes that are common to all of the subclasses. Attributes and relationships that are not
common to all subclasses remain with their respective subclass.
All instances in the generalization share the same key attribute. The key attribute is always
represented as an attribute of the top-level class only.
At Redbox, Movie DVD is a subset of a larger class, call it Rental. What other classes of objects
can be considered as a subclass of Rental? What attributes of the top-level class are inherited by
the subclasses? What attributes are not? Relationships?
There are two properties of a generalization that must be determined:
Total or Partial: The coverage of a generalization is Total if each instance of the top-level class is
mapped to at least one instance of the subclasses. It is Partial if instead there exists some instance
in the top-level class that is not mapped to any instance of the subclasses.
Exclusive or Overlapping: The coverage of a generalization is Exclusive (E) if each instance in
the top-level class is mapped to at most one instance of the subclasses. It is Overlapping (O) if
instead there exists some instance of the top-level class that is mapped to instances in two or
more subclasses.

Generalization Mapping
For each of the following Generalization Mappings, determine if it is Total or Partial, and
Exclusive or Overlapping. Explain your reasoning and assumptions.
1.

Balls

Footballs
2.

Basketballs

Baseballs

OSU Student Athlete

Football
Player
3.

Basketball
Player

Baseball
Player

Registered OSU Student

Undergraduate
Student

Graduate
Student

More Relationship Stuff


Recursive Relationship
An entity can participate in a relationship with itself, e.g.
Employee - MANAGES -|
|
|__________________|
The entity Employee contains all employees in an organization. With the relationship
MANAGES we also indicate the need to include in the database the hierarchical relationship of
employee and manager. Each side has cardinalities, e.g. an Employee can manage (0, n) other
employees and each Employee can have (0, 1) manager a minimum cardinality of 0 allows for
the employee at the top to not have another employee as a manager.

Relationships between three or more entities


While this representation is valid, its use is discouraged because of the multitude of
combinations that are possible, e.g. AB, AC, BC, ABC, with one schema. We will not use this
representation.
Weak Entity
An entity that does not have a key attribute of its own is called a weak entity. An instance in a
weak entity is identified by being related to a specific instance in a strong entity (an entity with a
unique key field.) A weak entity normally has a partial key, which is the attribute that can
uniquely identify an instance in relationship to its owner. A weak entity always has total
participation (1, 1) with respect to its identifying entity.
In a Chen schema, a weak entity is identified by a double box, and the relationship between a
weak entity and its identifying strong entity is identified by a double diamond.
Employee HAS Dependent
(0, n)
(1, 1)
A Dependent exists only in relationship to the employee; it is the employee that has the
Employee ID #. What would work as a partial key for Dependent?

You might also like