Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
MODELING
BCA20
Engr. Florence B. Reyes
STUDY OBJECTIVES
Understand concepts of data modeling
and its purpose
Learn how relationships between entities
are defined and refined, and how such
relationships are incorporated into the
database design process
Learn how ERD components affect
database design and implementation
Learn how to interpret the modeling
symbols
WHY DATA MODELING?
Represent “reality” of the actual database
Blue print: documentation
Effective Communication Tool
User involvement
Represent abstraction of requirements
Identify the business rules to be stored in
the database
Independence from a particular DBMS
CONCEPTUAL DATA MODELING
The conceptual data modeling revolves
around discovering and analyzing
organizational and users data
requirements.
What data is important
What data should be maintained
The major activity of this phase is
identifying entities, attributes, and
their relationships to construct model
using the Entity Relationship Diagram
methodology.
DEFINITIONS
Entity
A person, place, object, event or concept in the user
environment about which the organization wishes
to maintain data
Entity Type
A collection of entities that share common
properties or characteristics
Attribute
A named property or characteristic of an entity that
is of interest to an organization
DEFINITIONS
Relationship
an association between two or more entities
that is of particular interest
Relationship Types
While entity types are the nouns of a data
model, relationships are the verbs that connect
those nouns.
A set of meaningful associations among entity
types.
BACKGROUND
Developed by Peter Chen in 1976
ERD is commonly used to:
Translate different views of data among
managers, users, and programmers to fit into
a common framework.
Define data processing and constraint
requirements to help us meet the different
views.
Help implement the database.
WHY USE ER DIAGRAM ?
Itprovides a global quick reference to an
organization’s data structures.
Can be used individually to design an
Information System’s (IS) data structure
Can be used with Data Flow Diagrams to
provide a more comprehensive IS logical
design.
BASIC ERD ELEMENTS
Entity: a collection of people, places,
objects, events, concepts of interest (a
table)
Entity instance – a member of the Entity : a
person, a place, an object … (a row in a table)
Attribute - property or characteristic of
interest of an entity (a field in a table)
Relationship – association between
entities (corresponds to primary key-
foreign key equivalencies in related
tables)
IDENTIFY THE ENTITIES
“A fundamental THING of relevance to the
enterprise about which data may be kept”
What should be an Entity: both tangible &
intangible
An object that will have many instances in the database
An object that will be composed of multiple attributes
An object that we are trying to model
What should NOT be an Entity:
A user of the database system
An output of the database system (e.g. a report)
IDENTIFY THE ENTITIES
Any entity can be classified in one of the
following categories:
Regular Entity:
any physical object, event, or abstract concept
that we can record facts about.
Weak Entity:
any entity that depends on another entity for
its existence.
ERD USING IE NOTATION (MOST
POPULAR)
ENTITY INSTANCE
Entity instance: a single occurrence of an entity.
6 instances
15
DETERMINE THE ATTRIBUTES
Every Entity has attributes.
Attributes are characteristics that allow
us to classify/describe an entity
e.g., entity STUDENT has the attributes:
student number
name
date of birth
course number
CLASSES OF ATTRIBUTES
Simple attribute
Composite attribute
Derived attributes
Single-valued attribute
Multi-valued attribute
SIMPLE/COMPOSITE ATTRIBUTE
A simple attribute cannot be subdivided.
Examples: Age, Gender, and Marital status
A composite attribute can be further
subdivided to yield additional attributes.
Examples:
ADDRESS -- Street, City, State, Zip
PHONE NUMBER -- Area code, Exchange number
DERIVED ATTRIBUTE
Itis not physically stored within the
database
Instead, it is derived by using an
algorithm.
Example: AGE can be derived from the date of
birth and the current date.
MS Access: int(Date() – Emp_Dob)/365)
SINGLE-VALUED ATTRIBUTE
Can have only a single (atomic) value.
Examples:
A person can have only one social security number.
A manufactured part can have only one serial
number.
A single-valued attribute is not
necessarily a simple attribute.
Part No: CA-08-02-189935
Location: CA, Factory#:08, shift#: 02, part#: 189935
MULTI-VALUED ATTRIBUTES
Can have many values.
Examples:
A person may have several college degrees.
A household may have several phones with different
numbers
A car color
EXAMPLE - “MOVIE DATABASE”
Entity:
Movie Star
Attributes:
SS#: “123-45-6789” (single-valued)
Cell Phone: “(661)123-4567, (661)234-5678” (multi-
valued)
Name: “Harrison Ford” (composite)
Address: “123 Main Str., LA, CA” (composite)
Birthdate: “1-1-50” (simple)
Age: 50 (derived)
KEY ATTRIBUTES
Certainattributes identify particular facts
within an entity, these are known as KEY
attributes.
RELATIONSHIP TYPE
diamond containing the
relationship’s name
IDENTIFYING
RELATIONSHIP TYPE
… Notation Guide
ATTRIBUTE
oval containing the attribute’s
name.
_____
KEY ATTRIBUTE
MULTIVALUED ATTRIBUTE
DERIVED ATTRIBUTE
Store Locations
Relationship
manager
qty Keeps
Attributes
pname
Product price
descrip
DEGREES OF A RELATIONSHIP
One-to-one (1:1)
1 1
Man Woman
One-to-many (1:n)
1 M
Customer Order
Many-to-many (n:m)
M M
Course Subject
One-to-one (1:1)
Man Woman
One-to-many (1:n)
Customer Order
Many-to-many (n:m)
Course Subject
1 M
Person Car
emp-name
emp-id
manager
employee works-for
worker
emp-street
emp-city
trans-number
trans-type
balance trans-amt
A Sample ER Diagram
TRY THIS! (ASSIGNMENT: DUE 12/6/17)
Draw an ER Diagram of the situation
stated on the next slide. Take note of the
key attributes, degrees of relationships,
and mandatory/optional relationships.
Use ½ crosswise yellow paper for your
illustration.
TRY THIS! (ASSIGNMENT: DUE 12/6/17)
STUDENTs attend COURSEs that consist of
many SUBJECTs.
A single SUBJECT (i.e. English) can be studied
in many different COURSEs.
Each STUDENT may only attend one COURSE.