0% found this document useful (0 votes)
138 views

Fundamentals of Database Systems: Lesson 2: Data Models

The document discusses different data models and their evolution. It covers topics like the relational model, entity relationship model, and different levels of data abstraction. Key aspects of data modeling like business rules and translating rules to model components are also explained.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
138 views

Fundamentals of Database Systems: Lesson 2: Data Models

The document discusses different data models and their evolution. It covers topics like the relational model, entity relationship model, and different levels of data abstraction. Key aspects of data modeling like business rules and translating rules to model components are also explained.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

FUNDAMENTALS

OF DATABASE
SYSTEMS
LESSON 2: DATA MODELS

Nguyễn Thị Hậu


University of Engineering and Technology,
Vietnam National University in Hanoi (UET-VNU)
[email protected]
Learning Objectives
•  About data modeling and 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
•  About emerging alternative data models and the need they fulfill
•  How data models can be classified by their level of abstraction

Nguyen Thi Hau - DBMS 2


Data Modeling and Data Models
•  Data modeling: Iterative and progressive process of creating a
specific data model for a determined problem domain
•  Data models: Simple representations of complex real-world data
structures
•  Useful for supporting a specific problem domain
•  Model - Abstraction of a real-world object or event

Nguyen Thi Hau - DBMS 3


Nguyen Thi Hau - DBMS 4
Data Model Basic Building Blocks
•  Entity: Unique and distinct object used to collect and store
data
•  Attribute: Characteristic of an entity
•  Relationship: Describes an association among entities
•  One-to-many (1:M)
•  Many-to-many (M:N or M:M)
•  One-to-one (1:1)
•  Constraint: Set of rules to ensure data integrity
•  An employee’s salary must have values that are between
6,000 and 350,000.
•  A student’s GPA must be between 0.00 and 4.00.
•  Each class must have one and only one teacher.

Nguyen Thi Hau - DBMS 5


The conceptual database model (Chen’s
model)

Nguyen Thi Hau - DBMS 6


Importance of Data Models
Are a communication tool

Give an overall view of the database

Organize data for various users

Are an abstraction for the creation of good


database

Nguyen Thi Hau - DBMS 7


Business Rules
Brief, precise, and unambiguous description of a
policy, procedure, or principle

Enable defining the basic building blocks

Describe main and distinguishing characteristics


of the data

Nguyen Thi Hau - DBMS 8


Sources of Business Rules

Company Department
Policy makers
managers managers

Direct
Written
interviews with
documentation
end users

Nguyen Thi Hau - DBMS 9


Reasons for Identifying and Documenting
Business Rules
•  Help standardize company’s view of data
•  Communications tool between users and designers
•  Allow designer to:
•  Understand the nature, role, scope of data, and business processes
•  Develop appropriate relationship participation rules and constraints
•  Create an accurate data model

Nguyen Thi Hau - DBMS 10


Business rules
• There are two types of business rules:
– Structural
– Procedural
• Example: All orders must have a Contact Number.

Nguyen Thi Hau - DBMS 11


Structural business rules
•  Indicate the types of information to be stored and how the information
elements interrelate à can always be diagrammed in the ERD
•  A sales record includes product, buyer, quantity, price, and discount.
•  All restaurant orders must be handled by a staff member(specifically, an
order taker).


Nguyen Thi Hau - DBMS 12


Procedural business rules
•  Procedural rules deal with the
prerequisites, steps, processes, or
workflow requirements of a
business.
•  Many procedural business rules are
related to time:
Event A must happen before event
B.
•  Some procedural business rules
cannot be diagrammed, but must
still be documented so that they
can be programmed later.
Nguyen Thi Hau - DBMS 13
Translating Business Rules into Data
Model Components
•  Nouns translate into entities
•  Verbs translate into relationships among entities
•  Relationships are bidirectional
•  Questions to identify the relationship type
•  How many instances of B are related to one instance of A?
•  How many instances of A are related to one instance of B?

Nguyen Thi Hau - DBMS 14


Naming Conventions
•  Entity names - Required to:
•  Be descriptive of the objects in the business environment
•  Use terminology that is familiar to the users
•  Attribute name - Required to be descriptive of the data
represented by the attribute
•  Proper naming:
•  Facilitates communication between parties
•  Promotes self-documentation

Nguyen Thi Hau - DBMS 15


Examples
• Identify
•  Entities?
•  Relationship?

Nguyen Thi Hau - DBMS 16


EVOLUTION OF DATA MODELS

Nguyen Thi Hau - DBMS 17


The Evolution of Data Models

Nguyen Thi Hau - DBMS 18


The Relational Model
•  Produced an automatic transmission database that replaced standard
transmission databases
•  Based on a relation
•  Relation or table: Matrix composed of intersecting tuple and attribute
•  Tuple: Rows
•  Attribute: Columns
•  Describes a precise set of data manipulation constructs

Nguyen Thi Hau - DBMS 19


Relational Model
Advantages Disadvantages
•  Structural independence is •  Requires substantial
promoted using independent hardware and system
tables software overhead
•  Tabular view improves •  Conceptual simplicity gives
conceptual simplicity untrained people the tools
•  Ad hoc query capability is based to use a good system poorly
on SQL •  May promote information
•  Isolates the end user from problems
physical-level details
•  Improves implementation and
management simplicity Nguyen Thi Hau - DBMS 20
Relational Database Management
System(RDBMS)
•  Performs basic functions provided by the hierarchical and network
DBMS systems
•  Makes the relational data model easier to understand and implement
•  Hides the complexities of the relational model from the user

Nguyen Thi Hau - DBMS 21


A Relational Diagram

Cengage Learning © 2015

Nguyen Thi Hau - DBMS 22


SQL-Based Relational Database
Application
•  End-user interface
•  Allows end user to interact with the data
•  Collection of tables stored in the database
•  Each table is independent from another
•  Rows in different tables are related based on common values in common
attributes
•  SQL engine
•  Executes all queries

Nguyen Thi Hau - DBMS 23


The Entity Relationship Model
•  Graphical representation of entities and their relationships in a
database structure
•  Entity relationship diagram (ERD)
•  Uses graphic representations to model database components
•  Entity instance or entity occurrence
•  Rows in the relational table
•  Connectivity: Term used to label the relationship types

Nguyen Thi Hau - DBMS 24


Chen Model

Nguyen Thi Hau - DBMS 25


Entity Relationship Model
Advantages Disadvantages
•  Visual modeling yields •  Limited constraint
conceptual simplicity representation
•  Visual representation makes it •  Limited relationship
an effective communication representation
tool •  No data manipulation language
•  Is integrated with the dominant •  Loss of information content
relational model occurs when attributes are
removed from entities to avoid
crowded displays

Nguyen Thi Hau - DBMS 26


The ER Model Notations

Nguyen Thi Hau - DBMS 27


Nguyen Thi Hau - DBMS 28
Questions
1.  Write the business rule(s) that govern the relationship between
AGENT and CUSTOMER.
2.  Given the business rule(s) you wrote in Problem 1, create the basic
Chen ERD.

Nguyen Thi Hau - DBMS 29


DEGREE OF DATA
ABSTRACTION

Nguyen Thi Hau - DBMS 30


Data Abstraction Levels

External level

Logical
independence

Physical
independence

Nguyen Thi Hau - DBMS 31


The External Model
•  End users’ view of the data environment
•  ER diagrams are used to represent the external views
•  External schema: Specific representation of an external view

Nguyen Thi Hau - DBMS 32


External Models for Tiny College

Nguyen Thi Hau - DBMS 33


The Conceptual Model
•  Represents a global view of the entire database by the entire
organization
•  Conceptual schema: Basis for the identification and high-level
description of the main data objects
•  Has a macro-level view of data environment
•  Is software and hardware independent
•  Logical design: Task of creating a conceptual data model

Nguyen Thi Hau - DBMS 34


Conceptual Model for Tiny College

Nguyen Thi Hau - DBMS 35


The Internal Schema
•  Representing database as seen by the DBMS mapping conceptual
model to the DBMS
•  Internal schema: Specific representation of an internal model
•  Uses the database constructs supported by the chosen database
•  Logical independence: Changing conceptual model without affecting
the external model
•  Physical independence: Changing physical model without affecting
the conceptual model

Nguyen Thi Hau - DBMS 36


Internal Schema for Tiny College

Nguyen Thi Hau - DBMS 37


Home work
Chapter 2 (Fundamentals of database systems)

Nguyen Thi Hau - DBMS 38

You might also like