Lecture 2 Data Models
Lecture 2 Data Models
Lecture 2 Data Models
Data Models
Learning Objectives
In this session, you will learn:
• About data modelling and why data models are important
• Types of Data Models
• How data models can be classified by their level of
abstraction
• ANSI/SPARC three Schema architecture
• What business rules are and how they influence database
design
2
Limitations/disadvantages of File Systems
Data Redundancy: Unnecessarily storing same data at different places
Lecture Slide 3
Data Models
• Model - Abstraction of a real-world object or event
• Data models:
- Collection of related concepts used to describe the
structure of a database, i.e. unique objects, data types,
relationships, and constraints
• Useful for supporting a specific problem domain
• Simple representations of complex real-world data
structures
4
Types of Data Models
• Conceptual data model: models to represent high level
concepts close to how the user perceives the data
- e.g. Entity Relationship Model, Object-Oriented Model
6
Logical Data Model
After designing a database using an ER model, how do we
implement it in a DBMS?
We need to transform the ER model to the logical data model
supported by the DBMS that we choose
In general, 3 logical data models exist
• Hierarchical model
• Network model
• Relational model
7
Hierarchical Database Model
DEPARTMENT
EMPLOYEE PROJECT
DEPARTMENT
EMPLOYEE PROJECT
9
Network Database Model
10
Hierarchical and Network Models
Hierarchical Models Network Models
11
The Relational Model
• Developed by E.F. Codd (IBM) in 1970
• Table (relations)
- Matrix consisting of row/column intersections
- Each row in a relation is called a tuple
• Model was conceptually simple at expense of computer
overhead
• Relational data management system (RDBMS)
- Performs same functions provided by hierarchical model
- Hides complexity from the user
• Relational diagram
- Representation of entities, attributes, and relationships
• Relational table stores collection of related entities
Lecture Slide 12
The Relational Model
Lecture Slide 13
Degrees of Data Abstraction
• Database designer starts with abstracted view, then
adds details
• Defined a framework for data modeling based on
degrees of data abstraction (1970s):
- External
- Conceptual
- Internal
- Physical
Lecture Slide 14
Three-schema Architecture
• The External Schema
- all external views integrated into single global view: combined user views which are
normalised.
- independent of both hardware and software
- Representation of the database as “seen” by the DBMS (maps the conceptual model
to the DBMS)
- Internal schema depicts a specific representation of an internal model
- Depends on specific database software (change in DBMS software requires internal
model be changed) 15
Degrees of Data Abstraction
Lecture Slide 16
ANSI/SPARC Three Schema Architecture
Physical
Data
organisation
17
ANSI/SPARC: American National Standards Institute/Standards Planning and Requirements Committee
Logical Database Design
• Map the conceptual data model into a logical data model
- Hierarchical, Network, Relational
• Analyse in detail the transactions, forms, displays and reports
required by the business functions supported by the database
• Identify data integrity and security requirements
18
Physical Database Design
• Define the logical database design to the chosen DBMS
• Decide on physical organisation of the data
• Access methods, Backup and Recovery, Performance
19
Degrees of Data Abstraction
External view
Conceptual view
Lecture Slide 20
Degrees of Data Abstraction
Internal view
Physical view
BH RH Tony Abbott 150790 Analyst 10 RH Brian Thomas…
01110110011000101000100111000010000100110011100100….
Lecture Slide 21
Terms and Concepts
Schema
Subschema
• Portion of the database seen by the application programs that produce the
desired information from the data within the database
22
Terms and Concepts
Program-Data Independence: Changing the structure or storage
characteristics of data would not require changing the applications that
accesses it. Only the data dictionary needs to be updated, but not the
applications!
Lecture Slide 23
Data Independence
Data Independence: Capacity to change the schema at one level of a database system without
having to change the schema at the next higher level.
24
ANSI / SPARC
Three Schema Architecture
Conceptual
Schema Physical data
independence
Internal
Schema
Lecture Slide 26
Business Rules
Succinct and unambiguous descriptions of policies,
procedures, or principles within a specific organization
• Apply to any organization that stores and uses data to
generate information
Description of operations to create/enforce actions within
an organization’s environment
• Must be in writing and kept up to date
• Must be easy to understand and widely disseminated
Describe characteristics of data as viewed by the
company
Lecture Slide 27
Business Rules-Examples
• A customer may generate many invoices.
• An invoice is generated by only one customer.
• A training session cannot be scheduled for fewer than
10 employees or for more than 30 employees.
Lecture Slide 28
Discovering Business Rules
Sources of business rules:
• Company managers
• Policy makers
• Department managers
• Written documentation
‒ Procedures
‒ Standards
‒ Operations manuals
• Direct interviews with end users
Lecture Slide 29
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?
‒ More about this in the upcoming sessions..
30
Summary
• A data model is a simple representations of complex
real-world data structures
• Types of data models
• Degree of abstraction, ANSI/SPARC three schema
architecture
• Business rules identify and define basic modeling
components
Lecture Slide 31
Homework
• Complete review questions from Coronel/Morris/Rob
text book, Chapter 2.
• Solve the problems from Coronel/Morris/Rob text book,
Chapter 2.
• Reading for next week: Coronel/Morris/Rob, Chapter 3.
Lecture Slide 32