Introduction to Database Design
First Edition (2019)
Published by:
Politeknik Sultan Mizan Zainal Abidin.
KM 08, Jalan Paka,
23000 Dungun, Terengganu Darul Iman.
Tel : 098400800
Fax : 09-8458781
www.psmza.edu.my
Copyright © 2019 @ramlah
All rights reserved. No part of this document may
reproduced, stored in retrieval system or transmitted in
any form or by any means (electronic, mechanical,
photocopying recording or otherwise) without the
permission of the copyright owner.
Preface
In the name of Allah, The Most Gracious and Merciful.
All praise to Allah S.W.T for His great loving kindness and
blessing, this book is successfully published.
This Introduction to Database Design book is designed
specifically for a first course in databases at the junior or
senior undergraduate, or first year graduate level. The
purpose in this text is to present the fundamental
concepts of database design. These concepts include
aspects of database design like fundamental of database,
DBMS, relational data model, Entity Relationship Model,
normalization, structured query language (SQL) and
database transaction management.
The authors would like to express deepest appreciation to
all those who have provided the possibility in publishing
this book especially family, friends and colleagues.
The book covers all the essential aspects of database
design based on those used in existing commercial or
experimental database design. Hopefully students and
lecturers can use it for a learning process.
Thank you.
Chapter Table of Contents Page
Contents
Chapter 1 Fundamentals of Database 2
Management System
Chapter 2 Relational Data Model 48
Chapter 3 Entity-Relationship(ER) 64
Model & Normalization
Chapter 4 Structured Query Language 96
(SQL)
Chapter 5 Database Transaction 132
Management
FUNDAMENTALS
1 OF DATABASE
MANAGEMENT
SYSTEM
In this chapter, you will:
Understand Database
Understand DBMS
Understand Data Model
Introduction to Database Design
UNDERSTAND DATABASE
Data: Database:
Known facts * A collection of related
that can be data/ Shared collection
recorded and of logically related data
have an implicit
meaning/ Raw (and a description of
facts; that is, this data), designed to
facts that have meet the information
not been yet
processed to needs of an
reveal their organization.
meaning to the
end user. * Is a centralized and
structured set of data
Information: stored on a computer
Facts (data) system.
that are
* Provide facilities for
arranged in retrieving, adding,
meaningful
patterns. modifying and deleting
data when required.
*Provides facilities for
transforming retrieved
data into useful
information.
Page | 2
Chapter 1: Fundamentals of Database Management System
EVOLUTION OF DATABASE
File-Based
Flat Files
Hierarchical Data Model
Network Data Model
Page | 3
Introduction to Database Design
Flat Files •Earlier, punched cards technology was
used to store data – later, files. But the
Hierarchical files have no as such advantage, rather
Data Model have several limitations.
•1968 File-Based: predecessor of
database, data was maintained in a flat
file.
•[1968-1980] Era of Hierarchical
Database: Prominent hierarchical
database model was IBM’s first DBMS
called IMS (Information Management
System).
•Mid 1960s Rockwell collaborates with
IBM to create the Information
Management System (IMS), IMS lead
the mainframe database market in 70’s
and early 80’s.
•In this model, files are related in a
parent/child manner, with each child
file having at most one parent file.
•The previous system FMS drawback of
accessing records and sorting records
which took a long time was removed in
this by the introduction of parent-child
relationship between records in
database.
•The origin of the data is called the root
from which several branches have data
at different levels and the last level is
called the leaf.
•The main drawback in this was if there
is any modification or addition made to
the structure then the whole structure
needed alteration which made the task
a tedious one.
Page | 4
Chapter 1: Fundamentals of Database Management System
Network •Early 1960s, Charles Bachmann developed
Data first DBMS at Honeywell, Integrated Data
Model Store (IDS).
Relational •It standardized in 1971 by the CODASYL
Model group (Conference on Data Systems
Languages).
•In Network data model, files are related as
owners and members, similar to the
common network model except that each
member file can have more than one
owner.
•In this the main concept of many-many
relationships got introduced. But this also
followed the same technology of pointers
to define relationships with a difference in
this made in the introduction if grouping of
data items as sets.
•1970-present Era of relational database
and Database Management System
(DBMS)
•Based on relational calculus, shared
collection of logically related data and a
description of this data, designed to meet
the information needs of an organization
•System catalog/metadata provides
description of data to enable program-data
independence; logically related data
comprises entities, attributes, and
relationships of an organizations
information.
•Data abstraction allows view level, a way
of presenting data to a group of users
and logical level, how data is understood
to be when writing queries.
Page | 5
Introduction to Database Design
MEMBERS
STUDENT FACULTY CORPORAT
FULL TIME PART TIME
Hierarchy Data Model
BankID State City LocationID
LocLocation Location Location
ID Address Address
Network Data Model
Page | 6
Chapter 1: Fundamentals of Database Management System
Relational Model
Page | 7
Introduction to Database Design
EVOLUTION OF RELATIONAL MODEL
Page | 8
Chapter 1: Fundamentals of Database Management System
Relational DBMS at glance:
Page | 9
Introduction to Database Design
DBMS FUNCTIONS
Page | 10
Chapter 1: Fundamentals of Database Management System
ADVANTAGES AND DISADVANTAGES OF
DBMS’S
Page | 11
Introduction to Database Design
IMPORTANT HISTORICAL
CONTRIBUTIONS 1970-72 – E.F. Codd
1960’s: Computers
became cost proposes the relational
effective for model for databases,
private companies, disconnecting the logical
and storage organization from the
capacity increases.
physical storage.
1976: P.Chen Early 1980’s: The first
proposes the commercially available
entity relationship relational DB systems
model (ERM) for start to appear at the
database design. beginning of 1980s with
Mid-1980s: Orcale ver 2
structured query
language becomes Early 1990s: industry trend
widely accepted changes Oracle survives
many go away.
standard
Late 1990’s: Large
Mid 1990’s: www investment in internet
appears companies – helps tools-
Early 21st Century: market boom in
Solid growth of DB web/internet/DB
applications connectors
continues.
Page | 12
Chapter 1: Fundamentals of Database Management System
IMPORTANCE OF DATABASES TO EVERYDAY LIFE
Page | 13
Introduction to Database Design
Additional Notes :
** Data redundancy also occurs in database
systems that have values repeated
unnecessarily in one or more records or fields,
within a table, or where the field is
replicated/repeated in two or more tables.
** There is data inconsistency between the files if
the same data is stored in different formats in
two files or if data must be matched between
files.
Major Steps in the Database Development
Process
Page | 14
Chapter 1: Fundamentals of Database Management System
Page | 15
Introduction to Database Design
SHARING CONCEPT OF DATA IN
DATABASE
Page | 16
Chapter 1: Fundamentals of Database Management System
Page | 17
Introduction to Database Design
PROPERTIES OF DATABASES
Page | 18
Chapter 1: Fundamentals of Database Management System
UNDERSTAND DBMS
Page | 19
Introduction to Database Design
FEATURES OF DMBS
Database Nonprocedural Transaction
Definition
Access Processing
Application Procedural Database
Development Language Tuning
Interface
CATEGORIES DBMS
Desktop • Example : Microsoft
databases Access, FoxPro,
FileMaker Pro, Paradox,
Lotus.
Server • Example : Oracle,
databases Microsoft SQL Server,
IBM, DB2.
Page | 20
Chapter 1: Fundamentals of Database Management System
THE TRADITIONAL APPROACH TO
INFORMATION PROCESSING
Page | 21
Introduction to Database Design
PROS AND CONS OF THE TRADITIONAL
APPROACH
PROS
Simple
*Matched existing business processes and functions
*Company's were not as interested in funding complicated
information sytems
Initially
low-cost
*Early computing was not viewed as beneficial for large
funding
*Systems were designed to be cheap in order to save on
cost
Page | 22
Chapter 1: Fundamentals of Database Management System
CONS
Lack of data
sharing
* Same data stored in multiple locations
* Caused unnecessary doubling of efforts for
processing and managing data
High costs in the long run
*Hiring data processors for each department was
very expensive, and each position was typically
working on the same thing just for a different area
• *Doubling of work as well as excessive
maintenance costs
Page | 23
Introduction to Database Design
Separated
ownership
* Business functions had a high sense of data
ownership
* Departments unwilling to share data for fear of
minimizing their superiority
Unmanaged
redundancy
* Multiple instances of the same data appeared
throughout various files, systems, and databases
* Information updated in one place was not
replicated to the other locations
* Disk space was very expensive, and redundancy
had a big impact on storage
•
Data
inconsistency
* Redundant data stored in various locations was
usually never stored the same way
* Formatting was not centrally managed
Page | 24
Chapter 1: Fundamentals of Database Management System
LIMITATIONS OF THE FILE PROCESSING
SYSTEM I FILE-BASED APPROACH
Separated and
Isolated Data
Data Duplication
Dependence of data
Disadvantages
Data Security Concurrent
Access
Anomalies
Data
Inflexibility
Page | 25
Introduction to Database Design
IMPORTANCE OF HAVING DBMS
Page | 26
Chapter 1: Fundamentals of Database Management System
DATABASE ARCHITECTURE
A •is a database that is under the control
Distributed of a central database management
system (DBMS) in which storage
Database devices are not all attached to a
common CPU. It may be stored in
multiple computers located in the
same physical location, or may be
dispersed over a network of
interconnected computers.
•Collections of data (e.g. in a database)
can be distributed across multiple
physical locations. A distributed
database can reside on network
servers on the Internet, on corporate
intranets or extranets, or on other
company networks. The replication
and distribution of databases improves
database performance at end-user
worksites.
Centralized •has all its data on one place. As it is
Database totally different from distributed
database which has data on
different places. In centralized
database as all the data reside on one
place so problem of bottle-neck can
occur, and data availability is not
efficient as in distributed database.
Page | 27
Introduction to Database Design
UNDERSTAND DATA MODEL
Data models Data The very Earlier
define how models first data
the logical define data models
structure of a model were not
database is how so
modeled. data is could be scientific,
Data Models connect flat hence they
ed to data- were
are each prone to
fundamental other models, introduce
and how where lots of
entities to they are all the duplicatio
introduce process data n and
abstraction in ed and used are update
a DBMS. stored to be anomalies
inside kept in
the the
system same
place.
Page | 28
Chapter 1: Fundamentals of Database Management System
THE EVOLUTION OF DATA MODELS
Genera Time Model Examples Comme
tion nts
First 1960s− File VMS/VSA Used
1970s System M mainly
on IBM
Second 1970s Hierarch IMS mainfra
Third ical ADABAS me
Mid- and IDS-II systems
1970s Network Manage
to Data DB2 d
present Model Oracle records,
Relation MS SQL- not
al Server relations
Data MySQL hips
Model Early
database
systems
Navigati
onal
access
Concept
ual
simplicit
y
Entity
Relation
ship (ER)
Page | 29
Introduction to Database Design
Fourth Mid- Object- Versant modelin
1980s Oriente FastObject g
Next to d s.Net and
Genera present Extende Objectivity support
tion d /DB for
Present Relation DB/2 UDB relationa
to al Oracle 10g l data
future modelin
XML dbXML g
Tamino Support
DB2 UDB complex
data
Extende
d
relationa
l
products
support
objects
and data
warehou
sing
Web
database
s
become
common
Organiza
tion and
Page | 30
Chapter 1: Fundamentals of Database Management System
Oracle 10g manage
MS SQL ment of
Server unstruct
ured
data
Relation
al and
object
models
add
support
for XML
docume
nts
LOGICAL DATA MODEL
A logical data model or logical schema is a data model of
a specific problem domain expressed independently of a
particular database management product or storage
technology (physical data model) but in terms of data
structures such as relational tables and columns, object-
oriented classes, or XML tags. This is as opposed to
a conceptual data model, which describes the semantics
of an organization without reference to technology
Page | 31
Introduction to Database Design
TYPES OF LOGICAL DATA MODEL
Object Based Logical Record Based Logical
Model Model
Entity Relationship Hierarchical data
Data Model model
Network data model
Relational data model
Object based Logical Model : E-R Model
The entity relationship model is based on a
perception of the world as consisting of a
collection of basic objects (entities) and
relationships among these objects.
The overall logical structure of a database can
be expressed graphically by an E-R diagram.
Page | 32
Chapter 1: Fundamentals of Database Management System
Record based Logical Model: Hierarchical
Data Model
A hierarchical database model is a data
model in which the data are organized into a
tree-like structure. The data are stored as
records which are connected to one another
through links. A record is a collection of fields,
with each field containing only one value.
Record based Logical Model: Network Data
Model model is a database
The network
model conceived as a flexible way of
representing objects and their relationships.
Its distinguishing feature is that the schema,
viewed as a graph in which object types are
nodes and relationship types are arcs, is not
restricted to being a hierarchy or lattice.
Page | 33
Introduction to Database Design
Record based Logical Model: Relational Data
Model
The relational model (RM)
for database management is an approach to
managing data using a structure and
language consistent with first-order predicate
logic, first described in 1969 by English
computer scientist Edgar F. Codd, where all
data is represented in terms of tuples,
grouped into relations. A database organized
in terms of the relational model is a relational
database.
Page | 34
Chapter 1: Fundamentals of Database Management System
In the relational model, related records are linked together with a
"key".
The purpose of the relational model is to provide
a declarative method for specifying data and
queries: users directly state what information the
database contains and what information they
want from it, and let the database management
system software take care of describing data
structures for storing the data and retrieval
procedures for answering queries.
Page | 35
Introduction to Database Design
THREE LEVEL ARCHITECTURE OF DBMS
Page | 36
Chapter 1: Fundamentals of Database Management System
In
It shows the architecture of DBMS.
Mapping is the process of transforming
request response between various database
levels of architecture.
The goal of the three-schema architecture is
to separate the user applications and the
physical database.
Mapping is not good for small database,
because it takes more time.
In External / Conceptual mapping, DBMS
transforms a request on an external schema
against the conceptual schema.
In Conceptual / Internal mapping, it is
necessary to transform the request from the
conceptual to internal levels.
In Conceptual / Internal mapping, it is
necessary to transform the request from the
conceptual to internal levels.
Page | 37
Introduction to Database Design
Conceptual Conceptual level describes the
Level structure of the whole database for a
group of users.
It is also called as the data model.
Conceptual schema is a representation
of the entire content of the database.
These schema contains all the
information to build relevant external
records.
These schema contains all the
information to build relevant external
records.
It hides the internal details of physical
storage.
Page | 38
Chapter 1: Fundamentals of Database Management System
External External level is related to the data which
Level is viewed by individual end users.
This level includes a no. of user views or
external schemas.
This level is closest to the user.
External view describes the segment of
the database that is required for a
particular user group and hides the rest of
the database from that user group
Physical Physical level describes the physical
Level storage structure of data in database.
It is also known as Internal Level.
This level is very close to physical storage
of data.
At lowest level, it is stored in the form of
bits with the physical addresses on the
secondary storage device.
At highest level, it can be viewed in the
form of files.
The internal schema defines the various
stored data types. It uses a physical data
model.
Page | 39
Introduction to Database Design
Three level architecture
Client-Server Architecture of DBMS
Page | 40
Chapter 1: Fundamentals of Database Management System
Client-Server Architecture of DBMS
Client-server architecture
(client/server) is a network
architecture in which each computer
or process on the network is either a
client or a server. Servers are
powerful computers or processes
dedicated to managing disk drives
(file servers), printers (print
servers), or network traffic (network
servers).
Client/server architectures that
have evolved can be distinguished by
the distribution of application logic
components across clients and
servers.
Three components of application
logic:
Input/output (I/O) @ presentation
logic
Processing Logic
Storage Logic
Page | 41
Introduction to Database Design
Page | 42
Chapter 1: Fundamentals of Database Management System
Page | 43
Introduction to Database Design
BENEFITS OF MOVING TO CLIENT/SERVER
ARCHITECTURE
Flexibility and Staged Facilitation
scalability delivery of of Web-
facilitates functionality enabled
business speeds applications
process deployment
reengineering
Benefits of
Moving To
Client/Server
Architecture
Reduced GUI
network traffic interfaces
due to ease
increased application
processing at use
data source
Page | 44
Chapter 1: Fundamentals of Database Management System
CATEGORIES OF DBMS
Desktop • Example : Microsoft
databases Access, FoxPro,
FileMaker Pro,
Server Paradox, Lotus.
databases
• Example : Oracle,
Microsoft SQL
Server, IBM, DB2.
CHARACTERISTIC
Page | 45
Introduction to Database Design
BENEFITS OF DESKTOP DATABASE
Inexpensive
Easy Dekstop User
DatabaseManagement
Friendly
Offer
Web
Solution
USERS of DBMS
End User
Users of DBMS Database
Administrator
Application
Programmer
Page | 46