8/3/2019 Chapter II: Data Models
1/29
Chapter II: Data Models
8/3/2019 Chapter II: Data Models
2/29
In this chapter, you will learn:In this chapter, you will learn:
Why data models are important About the basic data-modeling building blocks What business rules are and how they influence
database design How the major data models evolved How data models can be classified by level of
abstraction
8/3/2019 Chapter II: Data Models
3/29
The Importance of Data ModelsThe Importance of Data Models
DATA MODELS
Relatively simple representations, usually graphical,of more complex real-world data structures.
Supported by powerful database design tools, have
made it possible to substantially diminish thepotential errors in database design.
It represents data structures and theircharacteristics, relation, constraints, andtransformations.
8/3/2019 Chapter II: Data Models
4/29
MODEL Is an abstraction of more complex real-
world object or event
Its main function is to help you understandthe complexities of the real-world
environment.
8/3/2019 Chapter II: Data Models
5/29
Data ModelData Model
Basic Building BlocksBasic Building Blocks1. Entity is anything (person, place, thing or event)
about which data are to be collected or stored. University -- Students, Faculty Members, Courses
Airlines -- Pilots, Aircraft, Routes, Suppliers2. Attribute is a characteristic of entity, equivalent of
the fields in file system Student-- Student Number, Name, GPA, Date of Enrollment, Data of
Birth, Home Address, Phone Number, Major
Aircraft-- Aircraft Number, Date of Last Maintenance, Total Hours
Flown, Hours Flown since Last Maintenance
3. Relationship describes association among entities
8/3/2019 Chapter II: Data Models
6/29
3 types of relationship3 types of relationship
One-to-many (1:M) relationship
A painter paints many different painting, but each one of them ispainted by only one painter.
The painter (the one) is related to the painting (the many).
PAINTERpaints PAINTINGS as 1:M.
Many-to-many (M:N or M:M) relationship An employee may learn many job skills, and each job skill may be
learned by many employees.
EMPLOYEE learns SKILL as M:N
One-to-one (1:1) relationship
A retail companys management structure may require that each of its
stores be managed by a single employees. In turn, each store manager,who is an employee, manages only a single store.
EMPLOYEE manages STORE as 1:1.
8/3/2019 Chapter II: Data Models
7/29
Relationships are bidirectional:
One CUSTOMER can generate manyINVOICEs.
Each of the manyINVOICEs is generated by
only one CUSTOMER.
4. Constraints is a restriction on the data.
Constraint helps to ensure data integrity.
8/3/2019 Chapter II: Data Models
8/29
Business Rules
When DB designers are selecting ordetermining the entities, attributes, and
relationship that will be used in building a
data model, they may start by gaining a
thorough understanding of
What types of data are in an organization
How the data are used
In what time frames they are used
8/3/2019 Chapter II: Data Models
9/29
BusinessR
ules Is a brief, precise, and unambiguous
description of a policy, procedure, or
principle within a specific organization.
Derived from a detailed description of an
organizations operations, help to create
and enforce actions within that
organizations environment.
8/3/2019 Chapter II: Data Models
10/29
Example of business rules
A customer may generate many invoices.
An invoice is generated by only one customer
A training session cannot be scheduled for fewer than10 employees or for more than 30 employees.
Business rules establish entities, relationships andconstraints. For example, the first 2 business rulesestablished 2 entities, CUSTOMER and INVOICE,and 1:M relationship between those two entities.
The 3rd
business rule establishes a constraint: nofewer than 10 people and no more than 30 people; 2entities, EMPLOYEE and TRAINING; and arelationship between EMPLOYEE and TRAINING.
8/3/2019 Chapter II: Data Models
11/29
Discovering Business Rules
MAIN SOURCE OF BUSINESS RULES:
Company managers
Policy makers
Department managers
Written documentation (e.g. companys
procedures, standards, or operations manuals)
Direct interviews with end user
8/3/2019 Chapter II: Data Models
12/29
IMPORTANCE OF IDENTIFYINGAND DOCUMENTING
BUSINESS RULES: They help standardized the companys view of data
They can be a communications tool between users and
designers
They allow the designer to understand the nature, roleand scope of the data.
They allow the designer to understand business
processes
They allow the designer to develop appropriaterelationship participation rules and constraints and to
create an accurate data model.
8/3/2019 Chapter II: Data Models
13/29
TRANSLATING BUSINESS RULES INTOTRANSLATING BUSINESS RULES INTO
DATA MODEL COMPONENTSDATA MODEL COMPONENTSGeneral rule:
A noun in a business rule will translate into
an entity in the model and a verb (active or
passive) associating nouns will translateinto a relationship among the entities.
For example:
A customer may generate many invoices
Nouns: CUSTOMER and INVOICES
Verb:may generate
8/3/2019 Chapter II: Data Models
14/29
To properly identify the type of relationship, you shouldconsider that relationships are bidirectional; that is, they
go both ways.
For example, the business rule
a customer may generate many invoicesis complemented by the business rule
an invoice is generated by only one customer
In that case, the relationship is one-to-many (1:M).
CUSTOMER is the 1 side, and INVOICE is the many side.
As a general rule, to properly identify the relationship type,you should ask two questions:
How many instances of B are related to one instance of A?
How many instances of A are related to one instance of B?
8/3/2019 Chapter II: Data Models
15/29
For example, you can assess the relationship
between student and class by asking twoquestions:
How many classes can one student enroll
in?
Answer: many classes
How many students can enroll in one class?
Answer: many students
Therefore, the relationship between student
and class is many-to-many (M:N).
8/3/2019 Chapter II: Data Models
16/29
The Evolution of Data ModelsThe Evolution of Data Models
8/3/2019 Chapter II: Data Models
17/29
Hierarchical Model
Hierarchical Model was developed in the
1960s to manage large amounts of data
complex manufacturing projects such as the
Apollo rocket that landed on the moon in1969.
Basic logical structure is represented by an
upside down treeIt was complex to implement, it was difficult to
manage, and it lacked structural independence.
8/3/2019 Chapter II: Data Models
18/29
Network Model
Was created to represent complex data
relationships more effectively than the
hierarchical model.
Conference on Data Systems Languages
(CODASYL) created the Database Task
Group (DBTG) to help establish database
standards. The DBTG was charged to definestandard specifications for an environment
that would facilitate database creation and
data manipulation.
8/3/2019 Chapter II: Data Models
19/29
Relational Data Model
Was introduced by E.F. Codd (of IBM) in
1970 in his landmark paper A Relational
Model of Data for Language Shared
Databanks
Represented a major breakthrough for both
users and designers.
Is implemented through a verysophisticated RDBMS.
8/3/2019 Chapter II: Data Models
20/29
Table is a matrix consisting of a series of
row/column intersections.
Also called relations, are related to eachother through the sharing of a common
entity characteristics (value in column).
Relational diagram is a representation of
the relational databases entities, the
attributes within those entities, and the
relationship between those entities.
8/3/2019 Chapter II: Data Models
21/29
The Entity Relationship Model
8/3/2019 Chapter II: Data Models
22/29
Entity Relationship (ER) Model or ERM
first introduced by Peter Chen in 1976
it was the graphical representation of entities andtheir relationships in a database structure that
quickly became popular because it complementedthe relational data model concepts
are normally represented in an Entity RelationshipDiagram (ERD), which uses graphical
representations to model database components.
8/3/2019 Chapter II: Data Models
23/29
ER Model components
Entity
represented in the ERD by a rectangle akaan entity box
the name of entity, a noun, is written in thecenter of the rectangle
a singular form and written in capitalletters
is described by a set of attributes thatdescribes particular characteristics of theentity
8/3/2019 Chapter II: Data Models
24/29
Relationships are represented by a diamond connected
to the related entities through a
relationship line the name of the relationship, an active or
passive verb, is written inside the diamond.
8/3/2019 Chapter II: Data Models
25/29
KEY
ENTITY Relationship
Mandatory One
Mandatory Many
Optional One
Optional Many
Cardinalities
8/3/2019 Chapter II: Data Models
26/29
EXAMPLE: 1:M Relationship
a PAINTER can paintmany PAINTINGs.
each PAINTING is painted by one PAINTER.
PAINTER PAINTINGpaint
s
8/3/2019 Chapter II: Data Models
27/29
EXAMPLE: M:N Relationship
an EMPLOYEE can learn many SKILLs.
each SKILL can be learned by many
EMPLOYEEs.
EMPLOYEE SKILLlearn
s
8/3/2019 Chapter II: Data Models
28/29
EXAMPLE: 1:1 Relationship
an EMPLOYEE manages one STORE
each STORE is managed by one EMPLOYEE
EMPLOYEE STOREmanage
s
8/3/2019 Chapter II: Data Models
29/29
Create an ER Diagram for a small furnituremanufacturing company, Pine ValleyFurniture.
This company can purchase items from anumber of different suppliers, who
then ship the items to themanufacturer. The items areassembled into products that are sold
to customers who order the products.Each order may include one or morelines corresponding to the productsappearing on that order.
Top Related