Chapter 2 Modeling Data in The Organization
Chapter 2 Modeling Data in The Organization
2
The overall Steps to analyze, design and
implement databases
“Business rules “
Business Rules
Business rule
• A statement that defines or constrains some
aspect of the business. It is intended to assert
business structure or to control or influence
the behavior of the business.
• Example: “A student may register for a section
of a course only if he or she has successfully
completed the prerequisites for that course.”
4
A Good Business Rule is:
• Declarative–what, not how
• Precise–clear, agreed-upon meaning
• Atomic–one statement
• Consistent–no conflicts internally and
externally
• Expressible–structured, natural language- no
misinterpretation
• Distinct–non-redundant
• Business-oriented–understood by business
people
5
Gathering business rules
• In descriptions of business functions, events,
policies, units, stakeholders, and other objects.
• Can be found in interview notes during
requirements collection sessions or organizational
documents (e.g., personnel manuals, policies,
contracts, marketing brochures, and technical
instructions)
• Identified by asking questions about the who, what,
when, where, why, and how of the organization
Business Rule Grammar
<entity> <minimum cardinality> <relationship>
<maximum cardinality> <entity>
8
Data Definitions
9
Guidelines for good data definition
– Gathered in conjunction with systems
requirements
– Accompanied by diagrams
– Iteratively created and refined
– Achieved by consensus
Enterprise Database Modeling
14
Entities
• Person: EMPLOYEE, STUDENT
• Place: WAREHOUSE, COUNTRY
• Object: BUILDING, MACHINE
• Event: SALE, REGISTRATION
• Concept: ACCOUNT, COURSE
17
Strong vs. Weak Entities (cont.)
20
A composite attribute
Multivalued:
Derived
an employee can have
from date employed and current date
more than one skill
This is an example
of time-stamping
An attribute
broken into
component parts
Multivalued
Derived
an employee can have
from date
more than one skill
employed and
current date
24
Attributes (cont.)
Identifiers (Keys)
• Identifier (Key)–An attribute (or combination
of attributes) that uniquely identifies
individual instances of an entity type
• Simple versus Composite Identifier
• Candidate Identifier–an attribute that could be
a key…satisfies the requirements for being an
identifier
25
Attributes (cont.)
Identifier Key
The key is underlined
Composite key attribute
28
Modeling Relationships
• A relationship is an association representing an interaction
among the instances of one or more entity types that is of
interest to the organization.
SHIP
SUPPLIER PART
WORK FOR
EMPLOYEE COMPANY
30
Relationship types and instances
a) Relationship type
(complete)
b) Relationship
instances
31
Relationships (cont.)
33
Relationships (cont.)
Two entities can have more than one type of
relationship between them (multiple relationships)
Employees and departments
Degree of Relationships
35
Relationships (cont.)
Degree of relationships
Entities of
One entity two different
related to types related
another of to each other Entities of three
the same different types
entity type related to each
other
36
Relationships (cont.)
a) Unary relationships
37
Relationships (cont.)
b) Binary relationships
38
Relationships (cont.)
c) Ternary relationship
Each entity in the relationship will have exactly one related entity
Is managed by
Department Manager
Manages
Relationships (cont.)
Cardinality of Relationships
• Second: One-to-Many (1:N) OR Many to one
(M:1)
Has
Patient Patient History
Belong
Relationships (cont.)
Cardinality of Relationships
• Third: Many -to-Many (M:M OR N:M)
Entities on both sides of the relationship can have many related
entities on the other side.
Work on
Employee project
Worked by
Relationships (cont.)
• Cardinality constraints (Modality)
• It is the number of instances of one entity that
can or must be associated with each instance of
another entity
• Minimum Cardinality
– If zero, then optional
– If one or more, then mandatory
• Maximum Cardinality
– The maximum number
Relationships (cont.)
Examples of cardinality constraints (cont.)
a) Mandatory cardinalities
c) Optional cardinalities
A person is married
to at most one other
person, or may not
be married at all
46
Relationships (cont.)
Cardinalities
Mandatory one
Mandatory many
Optional one
Optional many
47
Associative Entities
• An entity has attributes
48
Associative Entities (cont.)
A binary relationship with an attribute
49
Associative Entities (cont.)
50
Relationship symbols Attribute symbols
Entity symbols
An associative entity : A
special entity that is also
a relationship
Relationship degrees
specify number of entity
types involved
Relationship
cardinalities specify
how many of each
entity type is allowed
51
Activity