Database Systems
Data Modeling
Introduction
In designing databases, we begin by
examining the entities that are of
importance to an organization.
A conceptual data model is created to
capture the overall structure of the
entities and the relationships among
them
Entity-Relationship Diagram (ERD)
Most commonly used conceptual
model
Consists of:
Entities
Relationships among entities
Attributes of both the entities and their
relationships
Entity
An entity is a
person, place, thing,
or event which an
organization wishes
to maintain data
about
Examples:
Student
Subject
Instructor
An entity is
represented by a
rectangle
STUDENT
SUBJECT
Attributes
An attribute is a
characteristic of an
entity
Sample attributes
of the STUDENT
entity
Name
ID Number
Address
Birthday
An attribute is
represented by an
ellipse
Name
ID_Num
STUDENT
Address
Birthday
Value of an Attribute
The value of the type of characteristic
that an attribute represents
Example:
Attribute: Name
Values:
Juan De la Cruz
Brian Adams
The ERD contains only the attribute
type and not its values
6
Comparison of Attribute Types
Multivalued vs. single-valued
Composite vs. simple (or atomic)
Derived vs. stored
Multivalued Attributes
Attributes having
more than one
value for each
entity instance
Example:
Hobby - a student
may have more
than one hobbies
A multivalued
attribute is
represented by a
double ellipse
Hobby
STUDENT
Composite Attributes
An attribute
broken into
component parts
Derived Attribute
An attributes whose values can be
calculated from related attribute values
Derived
from date employed and
current date
10
Identification of Entity Instances
The relational model uses primary
keys to link related entities together
Primary key - an attribute or a
combination of attributes that uniquely
identifies an instance of an entity
Represented by underlining the
attribute(s) involved
ID_Num
11
Characteristics of a Primary Key
Unique - no two entity instances can
have the same value for the primary
key attribute
Not null
Must not change over time
12
Relationship
A relationship is a
natural association
between the
instances of one or
more entities
Example:
enrolls - a student
enrolls in a subject
A relationship is
represented by a
diamond-shaped
symbol
STUDEN
T
enrolls
SUBJEC
T
Relationships may
also have attributes
13
Types of Relationship
Three (3) possible types of relationship
can exist between the occurrences of
related entity types:
One-to-one relationship
One-to-many relationship
Many-to-many relationship
14
Cardinality
The number of instances that is
associated between a pair of entity types
The cardinality of the association from A
to B is the maximum number of
occurrences of B that can be associated
with A
A pair of associations can exist between
any two entities:
Ex. from A to B and from B to A
15
Examples of Cardinality
16