TKT309 (APSI) - Sesi 07 - Modul (Data Modelling and Analysis)
TKT309 (APSI) - Sesi 07 - Modul (Data Modelling and Analysis)
7-4
Data Modeling Concepts: Entity
Entity – a class of persons, places, objects,
events, or concepts about which we need to
capture and store data.
– Named by a singular noun
Persons: agency, contractor, customer,
department, division, employee,
instructor, student, supplier.
Places: sales region, building, room,
branch office, campus.
Objects: book, machine, part, product, raw material, software
license, software package, tool, vehicle model, vehicle.
Events: application, award, cancellation, class, flight, invoice,
order, registration, renewal, requisition, reservation, sale, trip.
Concepts: account, block of time, bond, course, fund,
7-5 qualification, stock.
Data Modeling Concepts: Entity
Entity instance – a single occurrence of an entity.
entity
Student ID Last Name First Name
2144 Arnold Betty
3122 Taylor John
3843 Simmons Lisa
instances 9844 Macy Bill
2837 Leath Heather
2293 Wrench Tim
7-6
Data Modeling Concepts:
Attributes
Attribute – a descriptive property or
characteristic of an entity. Synonyms
include element, property, and field.
– Just as a physical student can have
attributes, such as hair color, height,
etc., data entity has data attributes
7-7
Data Modeling Concepts: Data
Type
Data type – a property of an attribute that identifies what
type of data can be stored in that attribute.
Representative Logical Data Types for Attributes
Data Type Logical Business Meaning
NUMBER Any number, real or integer.
TEXT A string of characters, inclusive of numbers. When numbers are included in a
TEXT attribute, it means that we do not expect to perform arithmetic or
comparisons with those numbers.
MEMO Same as TEXT but of an indeterminate size. Some business systems require
the ability to attach potentially lengthy notes to a give database record.
DATE Any date in any format.
TIME Any time in any format.
YES/NO An attribute that can assume only one of these two values.
VALUE SET A finite set of values. In most cases, a coding scheme would be established
(e.g., FR=Freshman, SO=Sophomore, JR=Junior, SR=Senior).
7-8 IMAGE Any picture or image.
Data Modeling Concepts:
Domains
Domain – a property of an attribute that defines what
values an attribute can legitimately take on.
Representative Logical Domains for Logical Data Types
Data Type Domain Examples
NUMBER For integers, specify the range. {10-99}
For real numbers, specify the range and precision. {1.000-799.999}
TEXT Maximum size of attribute. Actual values usually Text(30)
infinite; however, users may specify certain narrative
restrictions.
DATE Variation on the MMDDYYYY format. MMDDYYYY
MMYYYY
TIME For AM/PM times: HHMMT HHMMT
For military (24-hour times): HHMM HHMM
YES/NO {YES, NO} {YES, NO} {ON, OFF}
7-9 VALUE SET {value#1, value#2,…value#n} {M=Male
{table of codes and meanings} F=Female}
Data Modeling Concepts:
Default Value
Default value – the value that will be recorded if
a value is not specified by the user.
7-12
Data Modeling Concepts:
Relationships
Relationship – a natural business
association that exists between one or
more entities.
The relationship may represent an event
that links the entities or merely a logical
affinity that exists between the entities.
7-13
Data Modeling Concepts:
Cardinality
Cardinality – the minimum and maximum
number of occurrences of one entity that may be
related to a single occurrence of the other entity.
Because all relationships are bidirectional,
cardinality must be defined in both directions for
every relationship.
bidirectional
7-14
Cardinality Notations
7-15
Data Modeling Concepts:
Degree
Degree – the number of entities that
participate in the relationship.
A relationship between two entities is called
a binary relationship.
A relationship between three entities is
called a 3-ary or ternary relationship.
A relationship between different instances
of the same entity is called a recursive
relationship.
7-16
Data Modeling Concepts:
Degree
Relationships may
exist between
more than two
entities and are
called
N-ary
relationships.
The example ERD
depicts a ternary
relationship.
7-17
Data Modeling Concepts:
Degree
Associative entity
– an entity that
inherits its primary
key from more than
one other entity
(called parents).
7-18
Data Modeling Concepts:
Recursive Relationship
Recursive relationship - a relationship that
exists between instances of the same entity
7-19
Data Modeling Concepts:
Foreign Keys
Foreign key – a primary key of an entity that is
used in another entity to identify instances of a
relationship.
– A foreign key is a primary key of one entity that is
contributed to (duplicated in) another entity to identify
instances of a relationship.
– A foreign key always matches the primary key in the
another entity
– A foreign key may or may not be unique (generally
not)
– The entity with the foreign key is called the child.
– The entity with the matching primary key is called the
7-20 parent.
Data Modeling Concepts:
Parent and Child Entities
Parent entity - a data entity that
contributes one or more attributes to
another entity, called the child. In a one-to-
many relationship the parent is the entity
on the "one" side.
7-23
Data Modeling Concepts:
Identifying Relationships
Identifying relationship – relationship in which the
parent entity’ key is also part of the primary key of the
child entity.
– The child entity is called a weak entity.
7-24
Data Modeling Concepts:
Sample CASE Tool Notations
7-25
Data Modeling Concepts:
Nonspecific Relationships
Nonspecific
relationship –
relationship where
many instances of
an entity are
associated with
many instances of
another entity.
Also called many-
to-many
relationship.
Nonspecific
relationships must
be resolved,
generally by
introducing an
associative entity.
7-26
Resolving Nonspecific
Relationships
7-27
Resolving Nonspecific
Relationships (continued)
Many-to-many
relationships can
be resolved with
an associative
entity.
7-28
Resolving Nonspecific
Relationships (continued)
Many-to-Many Relationship
7-29
Data Modeling Concepts:
Generalization
Generalization – a concept wherein the
attributes that are common to several types of an
entity are grouped into their own entity.
7-31
Process of Logical Data
Modeling
• Strategic Data Modeling
– Many organizations select IS development
projects based on strategic plans.
• Includes vision and architecture for information
systems
• Identifies and prioritizes develop projects
• Includes enterprise data model as starting point
for projects
• Data Modeling during Systems Analysis
– Data model for a single information system
is called an application data model.
7-32
Logical Model Development
Stages
1. Context Data model
– Includes only entities and relationships
– To establish project scope
2. Key-based data model
– Eliminate nonspecific relationships
– Add associative entities
– Include primary and alternate keys
– Precise cardinalities
3. Fully attributed data model
– All remaining attributes
– Subsetting criteria
4. Normalized data model
7-35
Entity Discovery
• In interviews or JRP sessions, pay attention to
key words (i.e. "we need to keep track of ...").
• In interviews or JRP sessions, ask users to
identify things about which they would like to
capture, store, and produce information.
• Study existing forms, files, and reports.
• Scan use case narratives for nouns.
• Some CASE tools can reverse engineer
existing files and databases.
7-36
The Context Data Model
7-37
The Key-based Data Model
7-38
The Key-based Data Model
with Generalization
7-39
The Fully-Attributed Data Model
7-40
What is a Good Data Model?
• A good data model is simple.
– Data attributes that describe any given entity
should describe only that entity.
– Each attribute of an entity instance can have only
one value.
• A good data model is essentially
nonredundant.
– Each data attribute, other than foreign keys,
describes at most one entity.
– Look for the same attribute recorded more than
once under different names.
• A good data model should be flexible and
7-41 adaptable to future needs.
Data Analysis & Normalization
Data analysis – a technique used to
improve a data model for implementation
as a database.
Goal is a simple, nonredundant, flexible, and
adaptable database.
7-44
First Normal Form Example 2
7-45
Second Normal Form Example 1
7-46
Second Normal Form Example 2
7-47
Third Normal Form Example 1
7-48
Third Normal Form Example 2
Transitive dependency
– when the value of a
nonkey attribute is
dependent on the value
of another nonkey
attribute other than by
derivation.
7-49
SoundStage 3NF Data Model
7-50
Data-to-Location-CRUD Matrix
7-51