DATABASE SYSTEM
DESIGN, IMPLEMENTTATION, & MANAGEMENT
Mathematical Economics Faculty
National Economics University
https://www.neu.edu.vn/ 1
Chapter 2: Data Models
3
Objectives
• Discuss data modeling and why data models are important
• Describe the basic data-modeling building blocks
Copyright@2021 by Faculty of Economic Mathematics
• Define what business rules are and how they influence
National Economics University
database design
• Understand how the major data models evolved
• Explain how data models can be classified by their level of
abstraction
4
2.1. Data Modeling and Data Models
• Data Modeling refers to the process of creating a specific data model for a determined
problem domain
• A problem domain:
Copyright@2021 by Faculty of Economic Mathematics
• Data Model: a representation, usually graphic, of a complex real-world data structure.
National Economics University
Data models are used in the database design phase of the Database Life Cycle.
• Model is an abstraction of a more complex real-world event.
• Within the database environment, a data model represents data structures and their
characteristics, relations, constrains, transformations and other constructs.
5
2.1. Data Modeling and Data Models
Data modelling is the first step in the process of database design.
This step is sometimes considered to be a high-level and abstract design phase, also
Copyright@2021 by Faculty of Economic Mathematics
referred to as conceptual design.
The aim of this phase is to describe:
National Economics University
• The data contained in the database (e.g., entities: students, lecturers, courses, subjects)
• The relationships between data items (e.g., students are supervised by lecturers;
lecturers teach courses).
• The constraints on data (e.g., student number has exactly eight digits; a subject has
four or six units of credit only).
6
2.1. Data Modeling and Data Models
There may be more than one correct solution!
Which solution is correct?
Copyright@2021 by Faculty of Economic Mathematics
National Economics University
“the one that meets all the end-user requirements”
Database designers make use of existing data-modeling constructs and
powerful database design tools that substantially diminish the potential for errors
in database modeling.
7
2.2. The importance of Data Models
• Facilitate interaction among the designer, the applications programmer and the end-user.
• The importance of data modeling cannot be overstated. Data constitutes the most basic
information employed by a system. Applications are created to manage data and to help
Copyright@2021 by Faculty of Economic Mathematics
transform data into information, but data is viewed in different ways by different people.
When a good database blueprint is available🡪 different views does not matter.
National Economics University
• The data model establishes stored procedures, relational tables, foreign and primary keys
• It gives a clear picture of the database, and database developers can use it for creating
physical databases.
• The data model is also useful for identifying redundant and missing data.
8
2.3. Data Model Basic Building Blocks
• Entity: a person, place, thing or event about which data will be collected and stored. Each entity
should be unique and distinct.
• Ex: customers, products, flight routes, invoices…
Copyright@2021 by Faculty of Economic Mathematics
• Attribute: a characteristic of an entity or object. An attribute has a name and a data type.
• Relationship: an association among entities.
National Economics University
• One-to-many(1:M or 1..*) relationship
• Many-to-many relationship
• One-to-one relationship
each relationship in both directions; that is, relationships are bidirectional:
• Constraint: a restriction placed on data, usually expressed in form of rules
• A student’s GPA must be between 0.00 and 4.00
• Each class must have one and only one a teacher
9
2.4. Business Rules
• Business rule: a description of a policy, procedure, or principle within an
organization
• A customer may generate many invoices
Copyright@2021 by Faculty of Economic Mathematics
• An invoice is generated by only one customer
National Economics University
• A training session cannot be scheduled for fewer than 10 employees or for
more than 30 employees
• Properly written business rules are used to define entities, attributes,
relationships, and constraints
• Business rules must be easy to understand and widely disseminated to ensure
that every person in the organization shares a common interpretation of the rules
10
2.4. Business Rules
• The process of identifying and documenting business rules is essential to
database design.
Copyright@2021 by Faculty of Economic Mathematics
• It helps to standardize the company’s view of data.
National Economics University
• It can be a communication tool between users and designers.
• It allows the designer to understand the nature, role, and scope of the
data.
• It allows the designer to understand business processes.
• It allows the designer to develop appropriate relationship participation
rules and constraints and to create an accurate data model.
11
2.4. Business Rules
Translating Business Rules into Data Model Components
• General Rule:
• A noun in a business rule will translate into an entity in the model.
Copyright@2021 by Faculty of Economic Mathematics
• A verb (active or passive) that associates the nouns will translate into a relationship among the entities
• To properly identify the relationship type, you should generally ask two questions:
National Economics University
• How many instances of B are related to one instance of A?
• How many instances of A are related to one instance of B?
A customer may generate many invoices The relationship is
one-to-many
Entity Entity
12
2.4. Business Rules
Naming Conventions
• Entity names should be descriptive of the objects in the business environment.
• An attribute name should also be descriptive of the data represented by that
Copyright@2021 by Faculty of Economic Mathematics
attribute.
National Economics University
• It is also a good practice to prefix the name of an attribute with the name or
abbreviation of the entity in which it occurs.
• Both entity names and attribute names should be uppercase.
• Example: CUS_ACC, CUS_INFO, CASA_TXN, LOAN_ACC…
13
Exercise
1. Write the business rules (s) that govern the relationship between AGENT and
CUSTOMER
2. An insurance company sells home, auto, and life insurance. The company has three
Copyright@2021 by Faculty of Economic Mathematics
departments – one for each type of insurance – and every department has its own group
National Economics University
of agents. A customer is assigned an agent based on the type of insurance he or she
desires. The agent then creates a policy for the customer.
3. A supermarket has many departments, each of which has employees. A few of employees
in each department manage it. An employee can only work in one department at any
given time. A department has many products, some of which can be offered in more than
one department at the same time. For instance, batteries are offered in the electronics,
toys, photo, groceries, and hardware departments.
2.5. The Evolution of Data Models
14
Copyright@2021 by Faculty of Economic Mathematics
National Economics University
15
2.5. The Evolution of Data Models
Hierarchical and Network Models
Network Models
Copyright@2021 by Faculty of Economic Mathematics
National Economics University
16
2.5. The Evolution of Data Models
The Relational Model
• Table(Relation): A logical construct perceived to be a two-dimensional
Copyright@2021 by Faculty of Economic Mathematics
structure composed of intersecting rows (entities) and columns(attributes) that
represents an entity set in the relational model.
National Economics University
• Tuple: a table row.
• Relational database management system: a collection of programs that
manages a relational database.
The Relational Model (I)
2.5. The Evolution of Data Models
17
Copyright@2021 by Faculty of Economic Mathematics
National Economics University
The Relational Model (II)
2.5. The Evolution of Data Models
18
Copyright@2021 by Faculty of Economic Mathematics
National Economics University
19
2.5. The Evolution of Data Models
The Entity Relationship Model
• Entity Relationship Model(ERM): A data model that describes relationships (1:1,1:M and M:N)
among entities at the conceptual level with the help of ER diagrams.
• Entity Relationship Diagram(ERD): A diagram that depicts an entity relationship model’s entities,
Copyright@2021 by Faculty of Economic Mathematics
attribute, and relations.
National Economics University
• The ER model is based on 3 components:
• Entity:
• is represented in the ERD by a rectangle.
• The entity name is written in capital letters and in singular form.
• Each row is known as an entity instance or entity occurrence.
• Each entity consists of a set of attributes that describes particular characteristics of the entity
• Connectivity: the type of relationship between entities.
The Entity Relationship Model(I)
2.5. The Evolution of Data Models
20
Copyright@2021 by Faculty of Economic Mathematics
National Economics University
2.5. Crow’s Foot Notation
21
Copyright@2021 by Faculty of Economic Mathematics
National Economics University
2.5. Crow’s Foot Notation
22
Copyright@2021 by Faculty of Economic Mathematics
National Economics University
Exercises
• Problems 2-5 (page 63-64)
23
Copyright@2021 by Faculty of Economic Mathematics
National Economics University
2.6. Degrees of Data Abstraction
24
Copyright@2021 by Faculty of Economic Mathematics
National Economics University
25
2.6. Degrees of Data Abstraction
The External Model
• Represent the user’s view
of the database
Copyright@2021 by Faculty of Economic Mathematics
• Contain multiple different
external views
National Economics University
26
2.6. Degrees of Data Abstraction
The Conceptual Model
• This Data Model defines WHAT the
system contains.
• The output of this process is a
Copyright@2021 by Faculty of Economic Mathematics
conceptual data model
that describes the main data
National Economics University
entities, attributes, relationships,
and constraints of a given
problem domain.
• This model is created by Business
stackholders and Data Architects.
27
2.6. Degrees of Data Abstraction
The Internal Model
• Defines HOW the system should be
implemented regardless of the DBMS
• This model is typically created by Data
Copyright@2021 by Faculty of Economic Mathematics
Architects and Business Analysts
• Involve mapping the entities in the
National Economics University
conceptual model to the tables in the
relational model
28
2.6. Degrees of Data Abstraction
The Physical Model
• This Data Model describes HOW the system will be implemented using a specific DBMS system
• This model is created by developers
Copyright@2021 by Faculty of Economic Mathematics
• Describe how the data is stored, they deal with
National Economics University
• Run-time performance
• File organization and access methods
• Data encryption