You are on page 1of 19

Database Design

Dr. S. K. Majumdar

2 March 2020 Dr. S. K. Majumdar


1
Why is Database design so important?
• Bad Design leads to wrong information and wrong
information leads to bad decisions.
• Good application can not overcome bad database design.
• A DBMS does not guaranty good data management or
correct or timely information.
• Database design is a process that produces a detailed
database blueprint in the form of ER diagrams. You can
not start building a house until you are happy with the
plan – same principle applies.

2 March 2020 Dr. S. K. Majumdar


2
Database Design Process Mini World

REQUIREMENTS COLLECTION
Functional Requirements AND ANALYSIS

Database requirements
FUNCTIONAL ANALYSIS
CONCEPTUAL DESIGN
Conceptual Schema
High-level Transaction
(in a high-level data model)
Specification
DBMS independent LOGICAL DESIGN
(DATA MODEL MAPPING)
DBMS specific
Logical (Conceptual) Schema
APPLICATION PROGRAM DESIGN (in the data model of specific DBMS)

PHYSICAL DESIGN
TRANSACTION IMPLEMENTATION

Application Programs Internal Schema (For the same DBMS)

2 March 2020 Dr. S. K. Majumdar


3
Phases of Database Design
1. Requirements collection and analysis
 Database Requirements
 Functional Requirements (operations on database)
2. Conceptual Design & Functional Analysis
 Create a conceptual schema
 High level transaction specification corresponding to
operations on database
3. Logical Design
 Map conceptual database schema to implementation
database schema
4. Physical Design
 Internal storage structures and file organizations are
specified
5. Application Program Design & Transaction Implementation (in
parallel to physical design)
2 March 2020 Dr. S. K. Majumdar
4
Data Analysis and
Data Modeling
Models are Simplified abstraction of Complex
Real-World Events or Conditions

02/03/2020 6
Data Model

• Graphical Representation of underlying


structure of a database is a data model
• A specification tool (class of data structures)
for conceptualizing and describing the
composition and behaviours of data, including
entities, relationships, semantics, constraints,
etc. Purpose: to capture information about
real world data.

2 March 2020 Dr. S. K. Majumdar


8
3 Levels of Data Modeling
Description of Entire Database (Big Picture)
What
Conceptual – Focus: What the Database should have?
data model e.g. E-R model, o-o model, semantic data model

Logical High level specification of an implementation.


How - Focus: How it is to be implemented (Application in Hand)?
DB design
(1). Hierarchical e.g. IMS
logical
(2). Network e.g. IDMS
data model
(3). Relational e.g. DB2, Oracle
Includes a query language to access and manipulate data.
Physical
Where
DB design

physical Describes data at a very low level, implementation


data model of records, tree, hash-index, concurrency control,
crash-recovery. (How computer sees it?)

2 March 2020 Dr. S. K. Majumdar


10
Conceptual Modelling
• Is the Conceptual view of Senior Managers
• Process of constructing a model of information
used in an enterprise, independent of all physical
considerations.
• The purpose is to show the basic building blocks for the
organization, i.e. the entities and rules about their
meaning and interrelationships
• E-R model is the most widely used conceptual model
and forms the basis of the visual representation of the
proposed database model.
• Conceptual Design focuses on the logical “what”
of the real world events & conditions.

2 March 2020 Dr. S. K. Majumdar


11
Logical Modelling

• Is the Logical Constructs of the database


• Process of constructing a model of information
used in an enterprise based on a specific data
model (e.g. relational/Network), but
independent of a particular DBMS and other
physical considerations.

• Logical design focuses on the logical “How” of


data-structuring and processing the data.

2 March 2020 Dr. S. K. Majumdar


12
Physical Modeling
• The way the entire database is physically
stored in the database

Data
Access Directories
Definition
Path
Secondary File
Software Organizations

Basic Access Methods


Hardware

2 March 2020 Dr. S. K. Majumdar


13
Physical Database Design
• Process of producing a description of the
implementation of the database on secondary
storage; it describes the base relations, file
organizations, and indexes design used to
achieve efficient access to the data, and
any associated integrity constraints and
security measures.

2 March 2020 Dr. S. K. Majumdar


14
2 March 2020 Dr. S. K. Majumdar
15
Methods of Data Analysis
1. Backus Naur Format (BNF)
a. Data
2. Productions
Decomposition
3. Data Structure Diagram

4. Information Modelling (ERDs) b. Data


Association

2 March 2020 Dr. S. K. Majumdar


16
Methods of Data Decomposition
To Reveal the Composition & Occurrence

Sequence Selection Iteration

1. BNF X = A + B+ C Z=U V M= N *

X Z M
2. Production A U V
B N *
C

3. Data X Z M
Structure
(WBS) A B C U V N *

2 March 2020 Dr. S. K. Majumdar


17
BNF (Backus Naur Format) - Example
• BNF has a grammar to describe the structure of data
Customer Order = Customer Name + Order No. + Address +
Date of Order + <Payment> + <Order Item> +
<Order Total>
<Payment> = Cheque No Credit Card No. (Either, or)
<Order Items> = <Items> *
<Items> = Item No. + Item Net Amount + Item Tax +
Item Total
<Order Totals> = Order Net Total + Order Tax Total +
Order Total
<Date order> = “DDMMYY”
<Payment> = Number

2 March 2020 Dr. S. K. Majumdar


18
Productions - Example
Production has similar style for expressing construction of the
structure of data
• Customer Order
Customer Name
Order No.
Customer order consists of
Address
Date of Order
Choice
• Payment
[ Cheque No Credit Card No ] Either Cheque or
• Order Items Credit Card

Items *
Item No. Item
Item Net Amount
Item Tax Consists of
Item Total
• Order Total
Order Net Total Order Total
Order Tax Total
Consists of
Order Total

2 March 2020 Dr. S. K. Majumdar


19
Logical Data Structure - Example
Customer
Order

Order Date of Customer Order


No. order Details Order
Items Payment Totals

Item* Cheque Credit


Name Address Address No. Card No

Item Item Item Item


Net Tax
No. Amount Amount Total

2 March 2020 Dr. S. K. Majumdar


20
Exercise: 4.4
Mr. Alexandr, the manager of KIMEP Book Store (KBS), decides to computerize KBS’s Books
Ordering and stock control system. A feasibility study has strongly suggested that a relational
database system be installed. The details of KBS's Books procurement and stock control are as
follows:
Professors of IM often send “Requisitions-for-Text-Books” for their courses roughly two months
before the beginning of their course. Each professor may send Zero, one or many requisitions. Each
requisition contains request(s) for variable quantities of one or more text books from various
publishers. KBS keeps a stock file showing for each book, edition and its publisher, the quantity in
stock, and then place “Purchase-Order(s)-for Books” for fresh stock, if required.
On arrival of these books, KBS updates its stock and sale those books to the students and raise
“Invoice”/ “Bill-of-Purchase” and collect “Payments”. KBS usually sales books on cash, but do
offer maximum of two moths of credit on request and maintains records of “Accounts-Receivables”
for each invoice. Generally publishers keep sufficient stock of books. The books that are out of stock
are often placed on a back-order-list and often re-order them from alternative sources.
A student may buy one or many books at a time and in response to the requirements of students, KBS
prepare invoice and collect payments. Sometimes KBS receives payment for one invoice, several
invoices or part-of an invoice.
Notes: Invoice = Bill of Purchase – a commercial term.
Use BNF, Production and Data Structure methods to describe the structure of the followings:
A Professors Requisition for text Books”
B Requisition for Purchase
C Invoice for the students

2 March 2020 Dr. S. K. Majumdar


21
An Exercise
• Invoice
• Order Placement
• Order Enquiry
• Product Enquiry
• Payment
• Delivery
• Sales Report

2 March 2020 Dr. S. K. Majumdar


22

You might also like