Chapter 2
Chapter 2
2
This chapter introduces the concepts of Data Modeling and Normalization.
Data Modeling
• Before implementing databases of any sort, a DBA or DA needs to develop a sound model of the
data to be stored.
• Novice database developers frequently begin with the quick-and-dirty approach to database
implementation. They approach database design from a programming perspective.
• Because novices often lack experience with databases and data requirements gathering, they
attempt to design databases like the flat files they are accustomed to using.
• This is a major mistake. Indeed, most developers using this approach quickly discover problems
after the databases and applications become operational in a production environment.
• At a minimum, performance will suffer and data may not be as readily available as required. At
worst, data integrity problems may arise, rendering the entire application unusable.
Requirement of Data Modeling
• What is required is a practiced and formal approach to gathering data requirements and
modeling the data, that is, the discovery and identification of entities and data elements.
• Data normalization is a big part of data modeling and database design.
• A normalized data model reduces data redundancy and inconsistencies by ensuring that the
data elements are designed appropriately.
Data Modeling Concepts
Data modeling requires a different mindset than requirements gathering for application
development and process-oriented tasks. It is important to think "what" is of interest instead of
"how" tasks are accomplished. To transition to this alternative way of thinking, follow these three
rules.
The Enterprise Data Model(THREE
RULES)
Keep in mind
As you create your data models, you are developing the
lexicon of your organization's business. Much like a
dictionary functions as the lexicon of a given language, the
data model functions as the lexicon of business terms and
their usage.
Data Modeling
Data Objects
A Data Object is a representation of a composite information that must be understood and processed by the system.
(Example: “Width” cannot be Data Object but “Dimension” can be)
• An Entity (i.e Person)
• A thing (i.e Report)
• An occurrence (i.e Telephone call)
• Event (i.e Alarm)
• A role (i.e Sales person)
• A place (i.e Warehouse)
• A structure (i.e File)
Data Modeling
Attributes
An attribute is a characteristic of an entity. Every attribute does one of three things:
• Identifies. An attribute that identifies is a candidate key. If the value of an identifying attribute
changes, it should identify a different entity occurrence.
• Relates. An attribute that relates entities is a foreign key. The attribute refers to the primary key
attribute of an occurrence of another (or the same) entity.
• Describes. An attribute is descriptive if it depicts or express a characteristic of an entity
occurrence, but does not identify or relate.
• A candidate key is an attribute, or set of attributes, that can be used to uniquely identify an
occurrence of the entity.
• The primary key is chosen from the set of candidate keys and is used to identify an entity
occurrence.
The primary key must guarantee the uniqueness of an entity occurrence.
1. The value of any component of the primary key cannot be null.
Relationships define how the different entities are associated with each
other. A relationship name should describe the role played by an entity
in its association with another (or perhaps the same) entity. The keys
define a relationship: the primary key in the parent entity and the
foreign key in the dependent entity.
Data Modeling (Relationships)
Optionality
The data model must also capture whether relationships are mandatory or optional. This is
commonly referred to as the optionality of the relationship.
Example: This data model fragment clearly states that an EMPLOYEE is employed by a STORE.
The STORE can have zero, one, or multiple EMPLOYEEs. If an EMPLOYEE exists, a
relationship to a STORE is mandatory. Furthermore, an EMPLOYEE can only work for one store.
Entity-Relationship Diagramming
• An E/R diagram graphically depicts the entities and relationships of a data model.
• Data models are typically rendered in a graphical format using an entity-relationship
diagram, or E/R diagram for short. An E/R diagram graphically depicts the entities and
relationships of a data model.
Entity-Relationship Diagramming
Methods
E/R diagramming methods: (1) Ross, (2) Bachmann, (3) Martin, (4) Chen, (5) Rumbaugh
ER - SAMPLE