Professional Documents
Culture Documents
CHAPTER 11 Slides
CHAPTER 11 Slides
Introduction
Introduction
Introduction
All information systems create, read, update and delete data. This
data is stored in files and databases.
Files are collections of similar records.
Information
System
File
File
Information
System
processing speed.
Cons:
Duplication of data items in multiple files is normally cited as
scaleability.
Prepared by Kevin C. Dittman for
Systems Analysis & Design Methods
4ed
Copyright Irwin/McGraw-Hill 1998
by J. L. Whitten & L. D. Bentley 5
Database Design
flexible formats.
Databases allow the use of the data in ways not originally
(establish
Data Requirements
system
PRODUCT
improvement
CUSTOMER
objectives)
product -no
customer-no product -name
customer-name unit-of-measure
SYSTEM customer-rat ing unit-price
S balance-due quantity-available
USERS
Y
S
(requirements) ORDER
T order-no
order-dat e
E
Definition Phase
products-ordered
quantit ies-ordered
M
(establish and
A data models prioritize
N
A Database Schema business system
L
Y PR OD U C T
requirements)
C U STO MER
S product _no [ A lpha( 10)] IN D EX
cus tome r_ no [ A lpha (1 0) ] IND product
EX _name [A lpha (3 2) ]
T SYSTEM cus tome r_ na me [ A lpha( 32 )] unit_ of _mea sure [A lpha (2 )]
cus tome r_ ra ting [ A lpha( 1) ] IN unit_
D EX price [ R eal( 3,2 )]
(specification) OR D ER O R D ER _ PR O D UC T
or de r_ no [ Alpha(12 )] IN D EX O R D ER .order_ no
or de r_ dat e [ D at e(mmddyyyyPR ) O D U C T.produc t_ no
C U STO MER.customer_no quantit y_order ed [Inte ger( 2)
Design Phase
(translate business
requirements into a
Database Programs
technical design)
CREATE TABLE CUSTOMER
SYSTEM (customer_no CHAR(10) NOT NULL
customer_name CHAR(32) NOT NULL
BUILDERS customer _rating CHAR(1) NOT NULL
balance_due DECIMAL(5,2)
CREATE INDEX cust_no_idx on CUSTOMER
(components)
CREATE INDEX cust_rt_idx on CUSTOMER
Implementation
Phase
(translate technical
Existing
design into code)
Existing Interfaces Existing
Existing Applications and Networks
Databases and Technology and
and Technology Technology
Technology
Fields
Fields are common to both files and databases.
A field is the implementation of a data attribute.
• A single file in a database may only have one primary key, but it
may have several secondary keys.
Fields
There are four types of fields that can be stored: primary keys,
secondary keys, foreign keys, and descriptive fields. (continued)
Foreign keys are pointers to the records of a different file in a
database.
• Foreign keys are how the database ‘links’ the records of one type
to those of another type.
Descriptive fields are any other fields that store business data.
Records
Fields are organized into records.
Like fields, records are common to both files and databases.
A record is a collection of fields arranged in a predefined format.
meaning that each record instance has the same fields, same
number of fields, and same logical size.
Variable-length record structures allow different records in the
Records
When a computer program ‘reads’ a record from a database, it
actually retrieves a group or block of records at a time.
This approach minimizes the number of actual disk accesses.
permanent.
• Once a record has been added to a master file, it remains in the
system indefinitely.
• The values of fields for the record will change over its lifetime, but
the individual records are retained indefinitely.
Prepared by Kevin C. Dittman for
Systems Analysis & Design Methods
4ed
Copyright Irwin/McGraw-Hill 1998
by J. L. Whitten & L. D. Bentley 15
Database Design
business events.
• The data describing these events normally has a limited useful
lifetime.
• In information systems, transaction records are frequently retained
on-line for some period of time.
• Subsequent to their useful lifetime, they are archived off-line.
Document files and tables contain stored copies of historical
data for easy retrieval and review without the overhead of re-
generating the document.
Databases
Databases provide for the technical implementation of entities and
relationships.
The history of information systems has led to one inescapable
conclusion:
Data is a resource that must be controlled and managed!
Databases
Data Architecture:
A business’ data architecture is comprised of the files and
databases that store all of the organization’s data, the file and
database technology used to store the data, and the organization
structure set up to manage the data resource.
Operational databases have been developed to support day-
Databases
Data Architecture:
Many information systems shops hesitate to give end-users
Databases
Data Architecture:
Personal computer and local network database technology has
Databases
Data Architecture:
To manage the enterprise-wide data resource, a staff of
Information System
A legacy
file-based Information Information
information File
System System
system Operational
(built Database (built
(built in-house) in-house)
Users and
in-house)
Programmers
File
End-User
File Tools
Data
Warehouse
End-User Users
Applications
File Personal
DB
A legacy
file-based
information
system File
End-User
Work Group
Users and
Programmers
Databases
Database Architecture:
Database architecture refers to the database technology
management system.
• A database management system (DBMS) is specialized computer
software available from computer vendors that is used to create,
access, control, and manage the database. The core of the DBMS is
often called its database engine. The engine responds to specific
commands to create database structures, and then to create, read,
update, and delete records in the database.
Prepared by Kevin C. Dittman for
Systems Analysis & Design Methods
4ed
Copyright Irwin/McGraw-Hill 1998
by J. L. Whitten & L. D. Bentley 25
Database Design
Databases
Database Architecture:
A systems analyst, or database analyst, designs the structure of
Systems Analysts
and/or
Database Designers End Users
Host-based
Transaction
Processing
Monitor
(optional)
Data Internal
Manipulation TP Monitor
Language (opt)
DML
Databases
Database Architecture:
Some data dictionaries include formal, elaborate software that
Databases
Database Architecture:
Many DBMSs don’t require the use of a DDL to construct the
Databases
Relational Database Management Systems:
There are several types of database management systems and they
Ordered
Customer places Order sells sold on Product
Product
Orders
Table
Order Customer Number …
Number (foreign key)
A633 10112
A634 10114
A635 10112
Products Table
Product Number Product Description Quantity …
in Stock
77B12 Widget 8000
77B13 Widget 0
77B15 Widget 52
77F01 Gadget 20
77F02 Gadget 2
Prepared by Kevin C. Dittman for
Systems Analysis & Design Methods
4ed
Copyright Irwin/McGraw-Hill 1998
by J. L. Whitten & L. D. Bentley 32
Database Design
Databases
Relational Database Management Systems:
Both the DDL and DML of most relational databases is called
Databases
Relational Database Management Systems:
High-end relational databases also extend the SQL language to
Data Analysis
The technique used to improve a data model in preparation for
database design is called data analysis.
Data analysis is a process that prepares a data model for
Data Analysis
Normalization is a three-step technique that places the data model
into first normal form, second normal form, and third normal
form.
An entity is in first normal form (1NF) if there are no
attributes that can have more than one value for a single
instance of the entity.
An entity is in second normal form (2NF) if it is already in
2NF, and if the values of its non-primary key attributes are not
dependent on any other non-primary key attributes.
Prepared by Kevin C. Dittman for
Systems Analysis & Design Methods
4ed
Copyright Irwin/McGraw-Hill 1998
by J. L. Whitten & L. D. Bentley 37
Database Design
Normalization Example
First Normal Form:
The first step in data analysis is to place each entity into 1NF.
is a
generates
PROMOTION
MERCHANDISE TITLE ---------Key Data-------------
-------------Key Data--------------- --------------Key Data-------------- Club-Name (PK1)
Product-Number (PK1) Product-Number (PK1) Promotion-Number (PK1)
Universal-Product-Code (PK1) Universal-Product-Code (PK2) -------Non-Key Data--------
---------Non-Key Data------------ ----------Non-Key Data----------- Product-Number (FK1)
Merchandise-Name Title-of-Work features Promotion-Release-Date
Merchandise-Description Title-Cover Promotion-Status
Merchandise-Size Catalog-Description Promotion-Type
Merchasnise-Color Copyright-Date Automatic-Fill-Delay
Unit-of-Measure Entertainment-Category
Credit-Value
is a
PRODUCT (1NF)
------------Key Data----------------
Product-Number (PK1)
Universal-Product-Code (PK2)
--------Non-Key Data-------------
Quantity-in-Stock
Product-Type
Suggested-Retail-Price
Club-Default-Unit-Price
Current-Special-Unit-Price
Current-Month-Units-Sold
Current-Year-Units-Sold
Total-Lifetime-Units-Sold
Prepared by Kevin C. Dittman for
Systems Analysis & Design Methods
4ed
Copyright Irwin/McGraw-Hill 1998
by J. L. Whitten & L. D. Bentley 40
Database Design
CLUB (1NF)
------------------Key Data----------------------
Club-Name (PK)
--------------Non-Key Data--------------------
Club-Description
Club-Charter-Date
establishes
CLUB (unnormalized)
------------------Key Data----------------------
Club-Name (PK) AGREEMENT (1NF)
--------------Non-Key Data-------------------- ----------Key Data-----------------
Club-Description Club-Name (PK1) (FK)
Club-Charter-Date Agreement-Number (PK1)
1 { Agreement-Number } n --------Non-Key Data-------------
1 { Agreement-Active-Date } n CORRECTION Agreement-Active-Date
1 { Agreement-Expiration-Date } n Agreement-Expiration-Date
1 { Obligation-Period } n Obligation-Period
1 { Required-Number-of-Credits } n Required-Number-of-Credits
1 { Bonus-Credits-After-Obligation } n Bonus-Credits-After-Obligation
MEMBER (unnormalized)
---------------------Key Data---------------------- enrolls in
Member-Number (PK1)
------------------Non-Key Data-------------------
Member-Name
Member-Status
Member-Address
Member-Daytime-Phone-Number
Date-of-Last-Order
Member-Balance-Due CLUB MEMBERSHIP (1NF)
Member-Bonus-Balance-Available -------------Key Data--------------
Member-Credit-Card-Information Member-Number (PK1) (FK)
1 { Club-Name } n Club-Name (PK1) (FK)
1 { Agreement-Number } n Agreement-Number (PK1) (FK)
1 { Taste Code } n ---------Non-Key Data-----------
1 { Media Preference } n Taste Code
1 { Date-Enrolled } n Media Preference
1 { Expiration-Date } n Date-Enrolled
CORRECTION Expiration-Date
1 { Number-of-Credits-Required } n
1 { Number of Credits-Earned } n Number-of-Credits-Required
Number of Credits-Earned
binds
AGREEMENT (1NF)
----------Key Data-----------------
Club-Name (PK1) (FK)
Agreement-Number (PK1) sponsors
--------Non-Key Data-------------
Agreement-Active-Date
Agreement-Expiration-Date
Obligation-Period
Required-Number-of-Credits
Bonus-Credits-After-Obligation
establishes
CLUB (1NF)
------------------Key Data----------------------
Club-Name (PK)
--------------Non-Key Data--------------------
Prepared by Kevin C. Dittman for Club-Description
Systems Analysis & Design Methods Club-Charter-Date
4ed
Copyright Irwin/McGraw-Hill 1998
by J. L. Whitten & L. D. Bentley 42
Database Design
Normalization Example
Second Normal Form:
The next step of data analysis is to place the entities into 2NF.
• It is assumed that you have already placed all entities into 1NF.
• 2NF looks for an anomaly called a partial dependency, meaning
an attribute(s) whose value is determined by only part of the
primary key.
• Entities that have a single attribute primary key are already in
2NF.
• Only those entities that have a concatenated key need to be
checked.
sold as
PRODUCT (2NF)
------------Key Data----------------
Product-Number (PK1)
Universal-Product-Code (PK2)
--------Non-Key Data-------------
Quantity-in-Stock
Product-Type
Suggested-Retail-Price
Club-Default-Unit-Price
Current-Special-Unit-Price
Current-Month-Units-Sold
Current-Year-Units-Sold
Total-Lifetime-Units-Sold
is a
Normalization Example
Third Normal Form:
Entities are assumed to be in 2NF before beginning 3NF analysis.
Normalization Example
Third Normal Form:
Third normal form analysis looks for two types of problems,
placed
Normalization Example
Simplification by Inspection:
When several analysts work on a common application, it is not
Normalization Example
CASE Support for Normalization:
Most CASE tools can only normalize to first normal form.
File Design
Introduction.
Most fundamental entities from the data model would be designed as
master or transaction records.
The master files a typically fixed length records.
Associative entities from the data model are typically joined into the
transaction records to form variable length records (based on the one-to-
many relationships).
Other types of files (not represented in the data model) are added as
necessary.
Two important considerations of file design are file access and
organization.
The systems analyst usually studies how each program will access the
Database Design
Introduction
The design of any database will usually involve the DBA and
database staff.
They will handle the technical details and cross-application
issues.
It is useful for the systems analyst to understand the basic design
principles for relational databases.
Database Design
retrieval of data.
A database should be reliable – the stored data should have
Database Design
Database Design
Database Design
as a separate table.
• The primary key is identified as such and implemented as an index
into the table.
• Each secondary key is implemented as its own index into the table.
• Each foreign key will be implemented as such.
• Attributes will be implemented with fields.
– These fields correspond to columns in the table.
Database Design
Database Design
follows:
• Most CASE tools do not currently support object-like constructs
such as supertypes and subtypes.
• Most CASE tools default to creating a separate table for each
entity supertype and subtype.
• If the subtypes are of similar size and data content, a database
administrator may elect to collapse the subtypes into the supertype
to create a single table.
3 Evaluate and specify referential integrity constraints.
Prepared by Kevin C. Dittman for
Systems Analysis & Design Methods
4ed
Copyright Irwin/McGraw-Hill 1998
by J. L. Whitten & L. D. Bentley 58
Database Design
Database Design
concatenated).
• The primary key must be controlled such that no two records in
the table have the same primary key value.
• The primary key for a record must never be allowed to have a
NULL value.
Database Design
Database Design
follows:
• No restriction.
– Any record in the table may be deleted without regard to any
records in any other tables.
• Delete:Cascade.
– A deletion of a record in the table must be automatically
followed by the deletion of matching records in a related table.
• Delete:Restrict.
– A deletion of a record in the table must be disallowed until any
matching records are deleted from a related table.
Prepared by Kevin C. Dittman for
Systems Analysis & Design Methods
4ed
Copyright Irwin/McGraw-Hill 1998
by J. L. Whitten & L. D. Bentley 61
Database Design
Database Design
follows: (continued)
• Delete:Set Null.
– A deletion of a record in the table must be automatically
followed by setting any matching keys in a related table to the
value NULL.
Database Design
Roles
Some database shops insist that no two fields have exactly the
same name.
This presents an obvious problem with foreign keys
Database Design
Database Prototypes
Prototyping is not an alternative to carefully thought out database
schemas.
On the other hand, once the schema is completed, a prototype
database can usually be generated very quickly.
Most modern DBMSs include powerful, menu-driven database
generators that automatically create a DDL and generate a
prototype database from that DDL.
A database can then be loaded with test data that will prove
Database Design
Database Design
Database Design
Introduction
Relational database technology is widely deployed and used in
contemporary information system shops.
One new technology is slowly emerging that could ultimately
change the landscape dramatically – object database management
systems.
The heir apparent to relational DBMSs, object database
Summary
Introduction
Conventional Files Versus the Database
Database Concepts for the Systems Analyst
Data Analysis for Database Design
File Design
Database Design
The Next Generation of Database Design