Database Systems

Preview:

DESCRIPTION

Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel(Class Notes)

Citation preview

1

1

Chapter 1

Database Systems

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

1

2Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn:

• The difference between data and information

• What a database is, about different types of

databases, and why they are valuable assets

for decision making

• Why database design is important

• How modern databases evolved from files

and file systems

1

3Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn (continued):

• About flaws in file system data management

• How a database system differs from a file

system, and how a DBMS functions within the

database system

1

4Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data vs. Information

• Data:

– Raw facts; building blocks of information

– Unprocessed information

• Information:

– Data processed to reveal meaning

• Accurate, relevant, and timely information is

key to good decision making

• Good decision making is key to survival in

global environment

1

5Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Sales per Employee for Each of

ROBCOR’s Two Divisions

1

6Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Introducing the Database

and the DBMS

• Database—shared, integrated computer

structure that houses:

– End user data (raw facts)

– Metadata (data about data)

1

7Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Introducing the Database

and the DBMS (continued)

• DBMS (database management system):

– Collection of programs that manages

database structure and controls access to

data

– Possible to share data among multiple

applications or users

– Makes data management more efficient and

effective

1

8Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

DBMS Makes Data Management More

Efficient and Effective

• End users have better access to more and

better-managed data

– Promotes integrated view of organization’s

operations

– Probability of data inconsistency is greatly

reduced

– Possible to produce quick answers to ad hoc

queries

1

9Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The DBMS Manages the Interaction

Between the End User and the Database

1

10Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Types of Databases

• Single-user:

– Supports only one user at a time

• Desktop:

– Single-user database running on a personal

computer

• Multi-user:

– Supports multiple users at the same time

1

11Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Types of Databases (continued)

• Workgroup:

– Multi-user database that supports a small

group of users or a single department

• Enterprise:

– Multi-user database that supports a large

group of users or an entire organization

1

12Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Location of Databases

• Centralized:

– Supports data located at a single site

• Distributed:

– Supports data distributed across several sites

1

13Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Uses of Databases

• Transactional (or production):

– Supports a company’s day-to-day operations

• Data warehouse:

– Stores data used to generate information

required to make tactical or strategic decisions

• Such decisions typically require ―data

massaging‖

– Often used to store historical data

– Structure is quite different

1

14Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Why Database Design is Important

• Defines the database’s expected use

• Different approach needed for different types

of databases

• Avoid redundant data (unnecessarily

duplicated)

• Poorly designed database generates errors

leads to bad decisions can lead to

failure of organization

1

15Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Historical Roots of Database:

Files and File Systems

• Although managing data through file systems is

largely obsolete

– Understanding relatively simple characteristics of

file systems makes complexity of database

design easier to understand

– Awareness of problems that plagued file systems

can help prevent similar problems in DBMS

– Knowledge of file systems is helpful if you plan to

convert an obsolete file system to a DBMS

1

16Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Manual File Systems

• Traditionally composed of collection of file

folders kept in file cabinet

• Organization within folders was based on

data’s expected use (ideally logically related)

• System was adequate for small amounts of

data with few reporting requirements

• Finding and using data in growing collections

of file folders became time-consuming and

cumbersome

1

17Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Conversion from Manual File System to

Computer File System

• Could be technically complex, requiring hiring

of data processing (DP) specialists

• DP specialists created file structures, wrote

software, and designed application programs

• Resulted in numerous ―home-grown‖ systems

being created

• Initially, computer files were similar in design

to manual files (see Figure 1.3)

1

18Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Contents of Customer File

1

19Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Basic File Terminology

1

20Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Example of Early Database Design

• DP specialist wrote programs for reports:

– Monthly summaries of types and amounts of

insurance sold by agents

– Monthly reports about which customers should

be contacted for renewal

– Reports that analyzed ratios of insurance types

sold by agent

– Customer contact letters summarizing coverage

• Additional reports were written as required

1

21Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Example of Early Database Design

(continued)

• Other departments requested databases be

written for them

– SALES database created for sales department

– AGENT database created for personnel

department

1

22Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Contents of the Agent File

1

23Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Evolution of Simple File System

• As number of databases increased, small file

system evolved

• Each file used its own application programs

• Each file was owned by individual or

department who commissioned its creation

1

24Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Simple File System

1

25Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Example of Early Database Design

(continued)

• As system grew, demand for DP’s

programming skills grew

• Additional programmers hired

• DP specialist evolved into DP manager,

supervising a DP department

• Primary activity of department (and DP

manager) remained programming

1

26Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Problems with

File System Data Management

• Every task requires extensive programming in

a third-generation language (3GL)

– Programmer must specify task and how it

must be done

• Modern databases use fourth-generation

language (4GL)

– Allows user to specify what must be done

without specifying how it is to be done

1

27Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Programming in 3GL

• Time-consuming, high-level activity

• Programmer must be familiar with physical

file structure

• As system becomes complex, access paths

become difficult to manage and tend to

produce malfunctions

• Complex coding establishes precise location

of files and system components and data

characteristics

1

28Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Programming in 3GL (continued)

• Ad hoc queries are impossible

• Writing programs to design new reports is time

consuming

• As number of files increases, system

administration becomes difficult

• Making changes in existing file structure is

difficult

• File structure changes require modifications in

all programs that use data in that file

1

29Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Programming in 3GL (continued)

• Modifications are likely to produce errors,

requiring additional time to ―debug‖ the

program

• Security features hard to program and

therefore often omitted

1

30Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Structural and Data Dependence

• Structural dependence

– Access to a file depends on its structure

• Data dependence

– Changes in database structure affect

program’s ability to access data

– Logical data format

• How a human being views the data

– Physical data format

• How the computer ―sees‖ the data

1

31Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Field Definitions

and Naming Conventions

• Flexible record definition anticipates reporting

requirements by breaking up fields into their

component parts

1

32Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Sample Customer File Fields

1

33Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Redundancy

• Data redundancy results in data inconsistency

– Different and conflicting versions of the same

data appear in different places

• Errors more likely to occur when complex

entries are made in several different files and

recur frequently in one or more files

• Data anomalies develop when required

changes in redundant data are not made

successfully

1

34Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Anomalies

• Modification anomalies

– Occur when changes must be made to

existing records

• Insertion anomalies

– Occur when entering new records

• Deletion anomalies

– Occur when deleting records

1

35Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Database vs. File System

• Problems inherent in file systems make using

a database system desirable

• File system

– Many separate and unrelated files

• Database

– Logically related data stored in a single logical

data repository

1

36Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Contrasting Database and File Systems

1

37Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Database System Environment

• Database system is composed of 5 main

parts:

1. Hardware

2. Software

• Operating system software

• DBMS software

• Application programs and utility software

3. People

4. Procedures

5. Data

1

38Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Database System Environment

(continued)

1

39Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

DBMS Functions

• Performs functions that guarantee integrity and

consistency of data

– Data dictionary management

• defines data elements and their relationships

– Data storage management

• stores data and related data entry forms, report

definitions, etc.

– Data transformation and presentation

• translates logical requests into commands to

physically locate and retrieve the requested data

1

40Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

DBMS Functions (continued)

– Security management

• enforces user security and data privacy within

database

– Multi-user access control

• creates structures that allow multiple users to

access the data

– Backup and recovery management

• provides backup and data recovery procedures

1

41Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

DBMS Functions (continued)

– Data integrity management

• promotes and enforces integrity rules to

eliminate data integrity problems

– Database access languages and application

programming interfaces

• provides data access through a query language

– Database communication interfaces

• allows database to accept end-user requests

within a computer network environment

1

42Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Illustrating Metadata

with Microsoft Access

1

43Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Illustrating Data Storage Management

with Oracle

1

44Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary

• Information is derived from data, which is stored

in a database

• To implement and manage a database, use a

DBMS

• Database design defines its structure

• Good design is important

1

45Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• Databases were preceded by file systems

• Because file systems lack a DBMS, file

management becomes difficult as a file

system grows

• DBMS were developed to address file

systems’ inherent weaknesses

1

46

Chapter 2

Data Model

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

1

47Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn:

• Why data models are important

• About the basic data-modeling building

blocks

• What business rules are and how they affect

database design

• How the major data models evolved, and

their advantages and disadvantages

• How data models can be classified by level of

abstraction

1

48Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Importance of Data Models

• Data model

– Relatively simple representation, usually

graphical, of complex real-world data

structures

– Communications tool to facilitate interaction

among the designer, the applications

programmer, and the end user

• Good database design uses an appropriate

data model as its foundation

1

49Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Importance of Data Modeling

• End-users have different views and needs for

data

• Data model organizes data for various users

1

50Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Model Basic Building Blocks

• Entity is anything about which data are to be

collected and stored

• Attribute is a characteristic of an entity

• Relationship describes an association among

(two or more) entities

– One-to-many (1:M) relationship

– Many-to-many (M:N or M:M) relationship

– One-to-one (1:1) relationship

1

51Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Business Rules

• Brief, precise, and unambiguous description

of a policy, procedure, or principle within a

specific organization’s environment

• Apply to any organization that stores and

uses data to generate information

• Description of operations that help to create

and enforce actions within that organization’s

environment

1

52Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Business Rules (continued)

• Must be rendered in writing

• Must be kept up to date

• Sometimes are external to the organization

• Must be easy to understand and widely

disseminated

• Describe characteristics of the data as viewed by the company

1

53Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Sources of Business Rules

• Company managers

• Policy makers

• Department managers

• Written documentation

– Procedures

– Standards

– Operations manuals

• Direct interviews with end users

1

54Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Importance of Business Rules

• Promote creation of an accurate data model

• Standardize company’s view of data

• Constitute a communications tool between users

and designers

• Allow designer to understand the nature, role,

and scope of data

• Allow designer to understand business

processes

• Allow designer to develop appropriate

relationship participation rules and constraints

1

55Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Evolution of Data Models

• Hierarchical

• Network

• Relational

• Entity relationship

• Object oriented

1

56Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Hierarchical Model—Evolution

• GUAM (Generalized Update Access Method)

– Based on the recognition that the many

smaller parts would come together as

components of still larger components

• Information Management System (IMS)

– World’s leading mainframe hierarchical

database system in the 1970s and early 1980s

1

57Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Hierarchical Model—Characteristics

• Basic concepts form the basis for subsequent

database development

• Limitations lead to a different way of looking

at database design

• Basic concepts show up in current data

models

• Best understood by examining manufacturing

process

1

58Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Hierarchical Structure

1

59Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Hierarchical Structure—Characteristics

• Each parent can have many children

• Each child has only one parent

• Tree is defined by path that traces parent

segments to child segments, beginning from

the left

• Hierarchical path

– Ordered sequencing of segments tracing

hierarchical structure

• Preorder traversal or hierarchic sequence

– ―Left-list‖ path

1

60Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Hierarchical Model

• Advantages

– Conceptual simplicity

– Database security

– Data independence

– Database integrity

– Efficiency

1

61Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Hierarchical Model (continued)

• Disadvantages

– Complex implementation

– Difficult to manage

– Lacks structural independence

– Complex applications programming and use

– Implementation limitations

– Lack of standards

1

62Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Child with Multiple Parents

1

63Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Network Model

• Created to

– Represent complex data relationships more

effectively

– Improve database performance

– Impose a database standard

• Conference on Data Systems Languages

(CODASYL)

• American National Standards Institute (ANSI)

• Database Task Group (DBTG)

1

64Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Crucial Database Components

• Schema

– Conceptual organization of entire database as viewed by the database administrator

• Subschema

– Defines database portion ―seen‖ by the application programs that actually produce the desired information from data contained within the database

• Data Management Language (DML)

– Define data characteristics and data structure in order to manipulate the data

1

65Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Management

Language Components

• Schema Data Definition Language (DDL)

– Enables database administrator to define

schema components

• Subschema DDL

– Allows application programs to define

database components that will be used

• DML

– Manipulates database contents

1

66Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Network Model—Basic Structure

• Resembles hierarchical model

• Collection of records in 1:M relationships

• Set

– Relationship

– Composed of at least two record types

• Owner

– Equivalent to the hierarchical model’s parent

• Member

– Equivalent to the hierarchical model’s child

1

67Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Network Data Model

1

68Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Network Data Model

• Advantages

– Conceptual simplicity

– Handles more relationship types

– Data access flexibility

– Promotes database integrity

– Data independence

– Conformance to standards

1

69Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Network Data Model (continued)

• Disadvantages

– System complexity

– Lack of structural independence

1

70Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Relational Model

• Developed by Codd (IBM) in 1970

• Considered ingenious but impractical in 1970

• Conceptually simple

• Computers lacked power to implement the

relational model

• Today, microcomputers can run sophisticated

relational database software

1

71Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Relational Model—Basic Structure

• Relational Database Management System

(RDBMS)

• Performs same basic functions provided by

hierarchical and network DBMS systems, plus

other functions

• Most important advantage of the RDBMS is

its ability to let the user/designer operate in a

human logical environment

1

72Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Relational Model—

Basic Structure (continued)

• Table (relations)

– Matrix consisting of a series of row/column

intersections

– Related to each other by sharing a common

entity characteristic

• Relational schema

– Visual representation of relational database’s

entities, attributes within those entities, and

relationships between those entities

1

73Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Relational Table

• Stores a collection of related entities

– Resembles a file

• Relational table is purely logical structure

– How data are physically stored in the

database is of no concern to the user or the

designer

– This property became the source of a real

database revolution

1

74Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Relational Schema

1

75Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Linking Relational Tables

1

76Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Relational Model

• Advantages

– Structural independence

– Improved conceptual simplicity

– Easier database design, implementation,

management, and use

– Ad hoc query capability

– Powerful database management system

1

77Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Relational Model (continued)

• Disadvantages

– Substantial hardware and system software

overhead

– Can facilitate poor design and implementation

– May promote ―islands of information‖ problems

1

78Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Entity Relationship Model

• Widely accepted and adapted graphical tool

for data modeling

• Introduced by Chen in 1976

• Graphical representation of entities and their

relationships in a database structure

1

79Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Entity Relationship Model—

Basic Structure

• Entity relationship diagram (ERD)

– Uses graphic representations to model

database components

– Entity is mapped to a relational table

• Entity instance (or occurrence) is row in table

• Entity set is collection of like entities

• Connectivity labels types of relationships

– Diamond connected to related entities through

a relationship line

1

80Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Relationships: The Basic Chen ERD

1

81Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Relationships:

The Basic Crow’s Foot ERD

1

82Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Entity Relationship Model

• Advantages

– Exceptional conceptual simplicity

– Visual representation

– Effective communication tool

– Integrated with the relational data model

1

83Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Entity Relationship Model (continued)

• Disadvantages

– Limited constraint representation

– Limited relationship representation

– No data manipulation language

– Loss of information content

1

84Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Object Oriented Model

• Semantic data model (SDM) developed by

Hammer and McLeod in 1981

• Modeled both data and their relationships in a

single structure known as an object

• Basis of object oriented data model (OODM)

• OODM becomes the basis for the object

oriented database management system

(OODBMS)

1

85Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Object Oriented Model (continued)

• Object is described by its factual content

– Like relational model’s entity

• Includes information about relationships

between facts within object and relationships

with other objects

– Unlike relational model’s entity

• Subsequent OODM development allowed an

object to also contain operations

• Object becomes basic building block for

autonomous structures

1

86Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Developments that

Boosted OODM’s Popularity

• Growing costs put a premium on code reusability

• Complex data types and system requirements became difficult to manage with a traditional RDBMS

• Became possible to support increasingly sophisticated transaction & information requirements

• Ever-increasing computing power made it possible to support the large computing overhead required

1

87Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Object Oriented Data Model—

Basic Structure

• Object: abstraction of a real-world entity

• Attributes describe the properties of an object

• Objects that share similar characteristics are

grouped in classes

• Classes are organized in a class hierarchy

• Inheritance is the ability of an object within

the class hierarchy to inherit the attributes

and methods of classes above it

1

88Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Comparison of the OO Model

and the ER Model

1

89Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Object Oriented Model

• Advantages

– Adds semantic content

– Visual presentation includes semantic content

– Database integrity

– Both structural and data independence

1

90Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Object Oriented Model (continued)

• Disadvantages

– Slow pace of OODM standards development

– Complex navigational data access

– Steep learning curve

– High system overhead slows transactions

– Lack of market penetration

1

91Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Other Models

• Extended Relational Data Model (ERDM)

– Semantic data model developed in response

to increasing complexity of applications

– DBMS based on the ERDM often described as

an object/relational database management

system (O/RDBMS)

– Primarily geared to business applications

1

92Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Other Models (continued)

• Date’s objections to ERDM label

– Given proper support for domains, relational

data models are quite capable of handling

complex data

• Therefore, capability that is supposedly being

extended is already there

– O/RDM label is not accurate because the

relational data model’s domain is not an object

model structure

1

93Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Models: A Summary

• Each new data model capitalized on the

shortcomings of previous models

• Common characteristics:

– Conceptual simplicity without compromising the

semantic completeness of the database

– Represent the real world as closely as possible

– Representation of real-world transformations

(behavior) must be in compliance with

consistency and integrity characteristics of any

data model

1

94Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Development of Data Models

1

95Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Database Models and the Internet

• Characteristics of successful ―Internet age‖

databases

– Flexible, efficient, and secure Internet access

that is easily used, developed, and supported

– Support for complex data types and

relationships

– Seamless interfacing with multiple data

sources and structures

1

96Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Database Models and the Internet

(continued)

– Relative conceptual simplicity to make

database design and implementation less

cumbersome

– An abundance of available database design,

implementation, and application development

tools

– A powerful DBMS graphical user interface

(GUI) to help make the DBA’s job easier

1

97Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Degrees of Data Abstraction

• Way of classifying data models

• Many processes begin at high level of

abstraction and proceed to an ever-

increasing level of detail

• Designing a usable database follows the

same basic process

1

98Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Degrees of Data Abstraction (continued)

• American National Standards

Institute/Standards Planning and

Requirements Committee (ANSI/SPARC)

– Classified data models according to their

degree of abstraction (1970s):

• Conceptual

• External

• Internal

1

99Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Abstraction Levels

1

100Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Conceptual Model

• Represents global view of the database

• Enterprise-wide representation of data as

viewed by high-level managers

• Basis for identification and description of

main data objects, avoiding details

• Most widely used conceptual model is the

entity relationship (ER) model

1

101Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Conceptual Model for Tiny College

1

102Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Advantages of Conceptual Model

• Provides a relatively easily understood macro

level view of data environment

• Independent of both software and hardware

– Does not depend on the DBMS software used

to implement the model

– Does not depend on the hardware used in the

implementation of the model

– Changes in either the hardware or the DBMS

software have no effect on the database

design at the conceptual level

1

103Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Internal Model

• Representation of the database as ―seen‖ by

the DBMS

• Adapts the conceptual model to the DBMS

• Software dependent

• Hardware independent

1

104Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The External Model

• End users’ view of the data environment

• Requires that the modeler subdivide set of

requirements and constraints into functional

modules that can be examined within the

framework of their external models

• Good design should:

– Consider such relationships between views

– Provide programmers with a set of restrictions

that govern common entities

1

105Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Division of an Internal Model into

External Models

1

106Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Advantages of External Models

• Use of database subsets makes application

program development much simpler

– Facilitates designer’s task by making it easier

to identify specific data required to support

each business unit’s operations

– Provides feedback about the conceptual

model’s adequacy

• Creation of external models helps to ensure

security constraints in the database design

1

107Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The External Model

• DBMS dependent

• Hardware independent

1

108Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The External Models for Tiny College

1

109Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Physical Model

• Operates at lowest level of abstraction,

describing the way data are saved on storage

media such as disks or tapes

• Software and hardware dependent

• Requires that database designers have a

detailed knowledge of the hardware and

software used to implement database design

1

110Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Levels of Data Abstraction

1

111Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary

• A good DBMS will perform poorly with a

poorly designed database

• A data model is a (relatively) simple

abstraction of a complex real-world data-

gathering environment

• Basic data modeling components are:

– Entities

– Attributes

– Relationships

1

112Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• Hierarchical model

– Based on a tree structure composed of a root

segment, parent segments, and child

segments

– Depicts a set of one-to-many (l:M)

relationships between a parent and its children

– Does not include ad hoc querying capability

1

113Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• Network model attempts to deal with many of the hierarchical model’s limitations

• Relational model:

– Current database implementation standard

– Much simpler than hierarchical or network design

• Object is basic modeling structure of object oriented model

• Data modeling requirements are a function of different data views (global vs. local) and level of data abstraction

1

114

Chapter 3

The Relational Database Model

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

1

115Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn:

• That the relational database model takes a

logical view of data

• That the relational model’s basic components

are entities, attributes, and relationships

among entities

• How entities and their attributes are

organized into tables

1

116Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn (continued):

• About relational database operators, the data

dictionary, and the system catalog

• How data redundancy is handled in the

relational database model

• Why indexing is important

1

117Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Logical View of Data

• Relational model

– Enables us to view data logically rather than

physically

– Reminds us of simpler file concept of data

storage

• Table

– Has advantages of structural and data

independence

– Resembles a file from conceptual point of view

– Easier to understand than its hierarchical and

network database predecessors

1

118Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Tables and Their Characteristics

• Table: two-dimensional structure composed of

rows and columns

• Contains group of related entities an entity

set

– Terms entity set and table are often used

interchangeably

1

119Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Tables and Their Characteristics

(continued)

• Table also called a relation because the

relational model’s creator, Codd, used the term

relation as a synonym for table

• Think of a table as a persistent relation:

– A relation whose contents can be permanently

saved for future use

1

120Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Characteristics of a Relational Table

Table 3.1

1

121Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

STUDENT Table Attribute Values

1

122Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Keys

• Consists of one or more attributes that

determine other attributes

• Primary key (PK) is an attribute (or a

combination of attributes) that uniquely

identifies any given entity (row)

• Key’s role is based on determination

– If you know the value of attribute A, you can

look up (determine) the value of attribute B

1

123Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Student Classification

1

124Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Keys (continued)

• Composite key

– Composed of more than one attribute

• Key attribute

– Any attribute that is part of a key

• Superkey

– Any key that uniquely identifies each entity

• Candidate key

– A superkey without redundancies

1

125Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Null Values

• No data entry

• Not permitted in primary key

• Should be avoided in other attributes

• Can represent

– An unknown attribute value

– A known, but missing, attribute value

– A ―not applicable‖ condition

• Can create problems in logic and using

formulas

1

126Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Controlled Redundancy

• Makes the relational database work

• Tables within the database share common

attributes that enable us to link tables

together

• Multiple occurrences of values in a table are

not redundant when they are required to

make the relationship work

• Redundancy is unnecessary duplication of

data

1

127Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

An Example of a

Simple Relational Database

1

128Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Relational Schema for the

CH03_SaleCo Database

1

129Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Keys (continued)

• Foreign key (FK)

– An attribute whose values match primary key

values in the related table

• Referential integrity

– FK contains a value that refers to an existing

valid tuple (row) in another relation

• Secondary key

– Key used strictly for data retrieval purposes

1

130Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Relational Database Keys

1

131Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Integrity Rules

1

132Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

An Illustration of Integrity Rules

1

133Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Dummy Variable Value Used as a Flag

1

134Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Relational Database Operators

• Relational algebra

– Defines theoretical way of manipulating table

contents using relational operators:

• SELECT

• PROJECT

• JOIN

• INTERSECT

– Use of relational algebra operators on existing

tables (relations) produces new relations

• UNION

• DIFFERENCE

• PRODUCT

• DIVIDE

1

135Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Relational Algebra Operators (continued)

• Union:

– Combines all rows from two tables, excluding

duplicate rows

– Tables must have the same attribute

characteristics

• Intersect:

– Yields only the rows that appear in both tables

1

136Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Union

1

137Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Intersect

1

138Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Relational Algebra Operators (continued)

• Difference

– Yields all rows in one table not found in the

other table—that is, it subtracts one table from

the other

• Product

– Yields all possible pairs of rows from two

tables

• Also known as the Cartesian product

1

139Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Difference

1

140Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Product

1

141Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Relational Algebra Operators (continued)

• Select

– Yields values for all rows found in a table

– Can be used to list either all row values or it

can yield only those row values that match a

specified criterion

– Yields a horizontal subset of a table

• Project

– Yields all values for selected attributes

– Yields a vertical subset of a table

1

142Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Select

1

143Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Project

1

144Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Relational Algebra Operators (continued)

• Join

– Allows us to combine information from two or

more tables

– Real power behind the relational database,

allowing the use of independent tables linked

by common attributes

1

145Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Two Tables That Will Be Used

in Join Illustrations

1

146Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Natural Join

• Links tables by selecting only rows with common values in their common attribute(s)

• Result of a three-stage process:

1. PRODUCT of the tables is created

2. SELECT is performed on Step 1 output to yield only the rows for which the AGENT_CODE values are equal

• Common column(s) are called join column(s)

3. PROJECT is performed on Step 2 results to yield a single copy of each attribute, thereby eliminating duplicate columns

1

147Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Natural Join, Step 1: PRODUCT

1

148Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Natural Join, Step 2: SELECT

1

149Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Natural Join, Step 3: PROJECT

1

150Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Natural Join (continued)

• Final outcome yields table that

– Does not include unmatched pairs

– Provides only copies of matches

• If no match is made between the table rows,

– the new table does not include the unmatched

row

1

151Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Natural Join (continued)

• The column on which we made the JOIN—that

is, AGENT_CODE—occurs only once in the

new table

• If the same AGENT_CODE were to occur

several times in the AGENT table,

– a customer would be listed for each match

1

152Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Other Forms of Join• Equijoin

– Links tables on the basis of an equality condition that compares specified columns of each table

– Outcome does not eliminate duplicate columns

– Condition or criterion to join tables must be explicitly defined

– Takes its name from the equality comparison operator (=) used in the condition

• Theta join

– If any other comparison operator is used

1

153Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Outer Join

• Matched pairs are retained and any unmatched values in other table are left null

• In outer join for tables CUSTOMER and AGENT, two scenarios are possible:

– Left outer join

• Yields all rows in CUSTOMER table, including those that do not have a matching value in the AGENT table

– Right outer join

• Yields all rows in AGENT table, including those that do not have matching values in the CUSTOMER table

1

154Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Left Outer Join

1

155Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Right Outer Join

1

156Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Divide

• DIVIDE requires the use of one single-column

table and one two-column table

1

157Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

DIVIDE

1

158Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Data Dictionary

and System Catalog

• Data dictionary

– Used to provide detailed accounting of all tables found within the user/designer-created database

– Contains (at least) all the attribute names and characteristics for each table in the system

– Contains metadata—data about data

– Sometimes described as ―the database designer’s database‖ because it records the design decisions about tables and their structures

1

159Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Sample Data Dictionary

1

160Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Data Dictionary

and the System Catalog (continued)

• System catalog

– Contains metadata

– Detailed system data dictionary that describes

all objects within the database

– Terms ―system catalog‖ and ―data dictionary‖

are often used interchangeably

– Can be queried just like any user/designer-

created table

1

161Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Relationships within the

Relational Database

• 1:M relationship

– Relational modeling ideal

– Should be the norm in any relational database design

• M:N relationships

– Must be avoided because they lead to data redundancies

• 1:1 relationship

– Should be rare in any relational database design

1

162Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The 1:1 Relationship

• Relational database norm

• Found in any database environment

• One entity can be related to only one other

entity, and vice versa

• Often means that entity components were not

defined properly

• Could indicate that two entities actually

belong in the same table

• Sometimes 1:1 relationships are appropriate

1

163Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The 1:1 Relationship Between

PROFESSOR and DEPARTMENT

1

164Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Implemented 1:1 Relationship Between

PROFESSOR and DEPARTMENT

1

165Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The 1:M Relationship

Between PAINTER and PAINTING

1

166Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Implemented 1:M Relationship

Between PAINTER and PAINTING

1

167Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The 1:M Relationship

Between COURSE and CLASS

1

168Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Implemented 1:M Relationship

Between COURSE and CLASS

1

169Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The M:N Relationship

• Can be implemented by breaking it up to

produce a set of 1:M relationships

• Can avoid problems inherent to M:N

relationship by creating a composite entity or

bridge entity

1

170Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The ERD’s M:N Relationship

Between STUDENT and CLASS

1

171Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Sample Student Enrollment Data

1

172Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The M:N Relationship

Between STUDENT and CLASS

1

173Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Linking Table

• Implementation of a composite entity

• Yields required M:N to 1:M conversion

• Composite entity table must contain at least

the primary keys of original tables

• Linking table contains multiple occurrences of

the foreign key values

• Additional attributes may be assigned as

needed

1

174Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Converting the M:N Relationship

into Two 1:M Relationships

1

175Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Changing the M:N Relationship

to Two 1:M Relationships

1

176Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Expanded Entity Relationship Model

1

177Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Relational Schema for the

Ch03_TinyCollege Database

1

178Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Redundancy Revisited

• Data redundancy leads to data anomalies

– Such anomalies can destroy database

effectiveness

• Foreign keys

– Control data redundancies by using common

attributes shared by tables

– Crucial to exercising data redundancy control

• Sometimes, data redundancy is necessary

1

179Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Small Invoicing System

1

180Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Relational Schema

for the Invoicing System

1

181Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Indexes

• Arrangement used to logically access rows in

a table

• Index key

– Index’s reference point

– Points to data location identified by the key

• Unique index

– Index in which the index key can only have

one pointer value (row) associated with it

• Each index is associated with only one table

1

182Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Components of an Index

1

183Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary

• Entities are basic building blocks of a

relational database

• Entity set is a grouping of related entities,

stored in a table

• Keys define functional dependencies

– Superkey

– Candidate key

– Primary key

– Secondary key

– Foreign key

1

184Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• Primary key uniquely identifies attributes

– Can link tables by using controlled redundancy

• Relational databases classified according to degree to which they support relational algebra functions

• Relationships between entities are represented by entity relationship models

• Data retrieval speed can be increased dramatically by using indexes

1

185

Chapter 4

Entity Relationship (ER) Modeling

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

1

186Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn:

• How relationships between entities are defined and refined, and how such relationships are incorporated into the database design process

• How ERD components affect database design and implementation

• How to interpret the modeling symbols for the four most popular ER modeling tools

• That real-world database design often requires that you reconcile conflicting goals

1

187Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Entity Relationship (ER) Model

• ER model forms the basis of an ER diagram

• ERD represents the conceptual database as

viewed by end user

• ERDs depict the ER model’s three main

components:

– Entities

– Attributes

– Relationships

1

188Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Entities

• Refers to the entity set and not to a single

entity occurrence

• Corresponds to a table and not to a row in the

relational environment

• In both the Chen and Crow’s Foot models, an

entity is represented by a rectangle

containing the entity’s name

• Entity name, a noun, is usually written in

capital letters

1

189Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Attributes

• Characteristics of entities

• In Chen model, attributes are represented by

ovals and are connected to the entity

rectangle with a line

• Each oval contains the name of the attribute it

represents

• In the Crow’s Foot model, the attributes are

simply written in the attribute box below the

entity rectangle

1

190Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Attributes of the STUDENT Entity

1

191Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Domains

• Attributes have a domain:

– The attribute’s set of possible values

• Attributes may share a domain

1

192Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Primary Keys

• Underlined in the ER diagram

• Key attributes are also underlined in

frequently used table structure shorthand

• Ideally composed of only a single attribute

• Possible to use a composite key:

– Primary key composed of more than one

attribute

1

193Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The CLASS Table (Entity)

Components and Contents

1

194Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Attributes

• Composite attribute

• Simple attribute

• Single-value attribute

• Multivalued attributes

1

195Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Multivalued Attribute in an Entity

1

196Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Resolving Multivalued Attribute Problems

• Although the conceptual model can handle

multivalued attributes, you should not implement them in the relational DBMS

– Within original entity, create several new

attributes, one for each of the original

multivalued attribute’s components

• Can lead to major structural problems in the table

– Create a new entity composed of original

multivalued attribute’s components

1

197Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Splitting the Multivalued

Attribute into New Attributes

1

198Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Components of the Multivalued Attribute

1

199Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A New Entity Set Composed of a

Multivalued Attribute’s Components

1

200Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Derived Attributes

• Attribute whose value may be calculated

(derived) from other attributes

• Need not be physically stored within the

database

• Can be derived by using an algorithm

1

201Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Depiction of a Derived Attribute

1

202Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Relationships

• Association between entities

• Participants:

– Entities that participate in a relationship

• Relationships between entities always

operate in both directions

• Relationship can be classified as 1:M

• Relationship classification is difficult to

establish if you only know one side

1

203Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Connectivity and Cardinality

• Connectivity

– Used to describe the relationship classification

• Cardinality

– Expresses the specific number of entity

occurrences associated with one occurrence

of the related entity

• Established by very concise statements

known as business rules

1

204Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Connectivity and Cardinality in an ERD

1

205Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

RELATIONSHIP Strength

• Existence dependence

– Entity’s existence depends on the existence of one or more other entities

• Existence independence

– Entity can exist apart from one or more related entities

• Weak (non-identifying) relationships

– One entity is not existence-independent on another entity

• Strong (Identifying) Relationships

– Related entities are existence-dependent

1

206Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Weak (Non-Identifying) Relationship

Between COURSE and CLASS

1

207Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Weak Relationship

Between COURSE and CLASS

1

208Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Relationship Participation

• Optional:

– One entity occurrence does not require a

corresponding entity occurrence in a particular

relationship

• Mandatory:

– One entity occurrence requires a

corresponding entity occurrence in a particular

relationship

1

209Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Strong (Identifying) Relationship

Between COURSE and CLASS

1

210Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

An Optional CLASS Entity in the Relationship

PROFESSOR teaches CLASS

1

211Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

COURSE and CLASS

in a Mandatory Relationship

1

212Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Relationship Strength and Weak Entities

• Weak entity meets two conditions

– Existence-dependent:

• Cannot exist without entity with which it has a

relationship

– Has primary key that is partially or totally

derived from the parent entity in the

relationship

• Database designer usually determines

whether an entity can be described as weak

based on the business rules

1

213Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Weak Entity in an ERD

1

214Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Weak Entity in a Strong Relationship

1

215Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Relationship Degree

• Indicates number of associated entities or

participants

• Unary relationship

– Association is maintained within a single entity

• Binary relationship

– Two entities are associated

• Ternary relationship

– Three entities are associated

1

216Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Three Types of Relationships

1

217Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Implementation

of a Ternary Relationship

1

218Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Recursive Relationships

• Relationship can exist between occurrences

of the same entity set

• Naturally found within a unary relationship

1

219Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

An ER Representation

of Recursive Relationships

1

220Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The 1:1 Recursive Relationship

―EMPLOYEE is Married to EMPLOYEE‖

1

221Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Implementation of the M:N Recursive

―PART Contains PART‖ Relationship

1

222Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Implementation of the 1:M ―EMPLOYEE

Manages EMPLOYEE‖ Recursive Relationship

1

223Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Composite Entities

• Also known as bridge entities

• Composed of the primary keys of each of the

entities to be connected

• May also contain additional attributes that

play no role in the connective process

1

224Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Converting the M:N Relationship

into Two 1:M Relationships

1

225Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The M:N Relationship

Between STUDENT and CLASS

1

226Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Composite Entity in an ERD

1

227Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Entity Supertypes and Subtypes

• Generalization hierarchy

– Depicts a relationship between a higher-level

supertype entity and a lower-level subtype

entity

• Supertype entity

– Contains shared attributes

• Subtype entity

– Contains unique attributes

1

228Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Nulls Created by Unique Attributes

1

229Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Generalization Hierarchy

1

230Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Disjoint Subtypes

• Also known as non-overlapping subtypes

– Subtypes that contain a subset of the

supertype entity set

– Each entity instance (row) of the supertype

can appear in only one of the disjoint subtypes

• Supertype and its subtype(s) maintain a 1:1

relationship

1

231Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The EMPLOYEE/PILOT

Supertype/Subtype Relationship

1

232Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Generalization Hierarchy

with Overlapping Subtypes

1

233Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Comparison of ER Modeling Symbols

1

234Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Chen Representation

of the Invoicing Problem

1

235Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Crow’s Foot Representation

of the Invoicing Problem

1

236Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Rein85 Representation

of the Invoicing Problem

1

237Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The IDEF1X Representation

of the Invoicing Problem

1

238Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Developing an ER Diagram

• Database design is an iterative rather than a

linear or sequential process

• Iterative process

– Based on repetition of processes and

procedures

1

239Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Supertype/Subtype Relationship

1

240Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Supertype/Subtype Relationship

in an ERD

1

241Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Components of the ER Model

1

242Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Completed Tiny College ERD

1

243Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Challenge of Database Design:

Conflicting Goals

• Database design must conform to design

standards

• High processing speeds are often a top

priority in database design

• Quest for timely information might be the

focus of database design

1

244Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Various Implementations

of a 1:1 Recursive Relationship

1

245Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary

• Entity relationship (ER) model

– Uses ER diagrams to represent conceptual

database as viewed by the end user

– Three main components

• Entities

• Relationships

• Attributes

– Includes connectivity and cardinality notations

• Connectivities and cardinalities are based on

business rules

1

246Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• ER symbols are used to graphically depict the

ER model’s components and relationships

• ERDs may be based on many different ER

models

• Entities can also be classified as supertypes

and subtypes within a generalization

hierarchy

• Database designers are often forced to make

design compromises

1

247

Chapter 5

Normalization of Database Tables

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

1

248Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn:

• What normalization is and what role it plays in the database design process

• About the normal forms 1NF, 2NF, 3NF, BCNF, and 4NF

• How normal forms can be transformed from lower normal forms to higher normal forms

• That normalization and ER modeling are used concurrently to produce a good database design

• That some situations require denormalization to generate information efficiently

1

249Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Database Tables and Normalization

• Normalization

– Process for evaluating and correcting table

structures to minimize data redundancies

• helps eliminate data anomalies

– Works through a series of stages called

normal forms:

• Normal form (1NF)

• Second normal form (2NF)

• Third normal form (3NF)

1

250Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Database Tables and Normalization

(continued)

– 2NF is better than 1NF; 3NF is better than

2NF

– For most business database design purposes,

3NF is highest we need to go in the

normalization process

– Highest level of normalization is not always

most desirable

1

251Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Need for Normalization

• Example: company that manages building

projects

– Charges its clients by billing hours spent on

each contract

– Hourly billing rate is dependent on employee’s

position

– Periodically, a report is generated that contains

information displayed in Table 5.1

1

252Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Sample Report Layout

1

253Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Table in the Report Format

1

254Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Need for Normalization (continued)

• Structure of data set in Figure 5.1 does not

handle data very well

• The table structure appears to work; report is

generated with ease

• Unfortunately, the report may yield different

results, depending on what data anomaly has

occurred

1

255Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Conversion to First Normal Form

• Repeating group

– Derives its name from the fact that a group of

multiple (related) entries can exist for any

single key attribute occurrence

• Relational table must not contain repeating

groups

• Normalizing the table structure will reduce

these data redundancies

• Normalization is three-step procedure

1

256Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Step 1: Eliminate the Repeating Groups

• Present data in a tabular format, where each

cell has a single value and there are no

repeating groups

• Eliminate repeating groups by eliminating

nulls, making sure that each repeating group

attribute contains an appropriate data value

1

257Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Organization: First Normal Form

1

258Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Step 2: Identify the Primary Key

• Primary key must uniquely identify attribute

value

• New key must be composed

1

259Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Step 3: Identify all Dependencies

• Dependencies can be depicted with the help

of a diagram

• Dependency diagram:

– Depicts all dependencies found within a given

table structure

– Helpful in getting bird’s-eye view of all

relationships among a table’s attributes

– Use makes it much less likely that an

important dependency will be overlooked

1

260Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Dependency Diagram:

First Normal Form (1NF)

1

261Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

First Normal Form

• Tabular format in which:

– All key attributes are defined

– There are no repeating groups in the table

– All attributes are dependent on primary key

• All relational tables satisfy 1NF requirements

• Some tables contain partial dependencies

– Dependencies based on only part of the primary key

– Sometimes used for performance reasons, but should be used with caution

– Still subject to data redundancies

1

262Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Conversion to Second Normal Form

• Relational database design can be improved

by converting the database into second

normal form (2NF)

• Two steps

1

263Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Step 1: Identify All Key Components

• Write each key component on separate line,

and then write the original (composite) key on

the last line

• Each component will become the key in a

new table

1

264Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Step 2: Identify the Dependent Attributes

• Determine which attributes are dependent on

which other attributes

• At this point, most anomalies have been

eliminated

1

265Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Second Normal Form (2NF)

Conversion Results

1

266Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Second Normal Form

• Table is in second normal form (2NF) if:

– It is in 1NF and

– It includes no partial dependencies:

• No attribute is dependent on only a portion of

the primary key

1

267Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Conversion to Third Normal Form

• Data anomalies created are easily eliminated

by completing three steps

1

268Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Step 1: Identify Each New Determinant

• For every transitive dependency, write its

determinant as a PK for a new table

– Determinant

• Any attribute whose value determines other

values within a row

1

269Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Step 2: Identify the Dependent Attributes

• Identify the attributes dependent on each

determinant identified in Step 1 and identify

the dependency

• Name the table to reflect its contents and

function

1

270Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Step 3: Remove the Dependent Attributes

from Transitive Dependencies

• Eliminate all dependent attributes in transitive

relationship(s) from each table that has such

a transitive relationship

• Draw a new dependency diagram to show all

tables defined in Steps 1–3

• Check new tables and modified tables from

Step 3 to make sure that each has a

determinant and does not contain

inappropriate dependencies

1

271Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Third Normal Form (3NF)

Conversion Results

1

272Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Third Normal Form

• A table is in third normal form (3NF) if:

– It is in 2NF and

– It contains no transitive dependencies

1

273Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Improving the Design

• Table structures are cleaned up to eliminate

the troublesome initial partial and transitive

dependencies

• Normalization cannot, by itself, be relied on to

make good designs

• It is valuable because its use helps eliminate

data redundancies

1

274Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Improving the Design (continued)

• The following changes were made:

– PK assignment

– Naming conventions

– Attribute atomicity

– Adding attributes

– Adding relationships

– Refining PKs

– Maintaining historical accuracy

– Using derived attributes

1

275Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Completed Database

1

276Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Completed Database (continued)

1

277Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Limitations on System-Assigned Keys

• System-assigned primary key may not

prevent confusing entries

• Data entries in Table 5.2 are inappropriate

because they duplicate existing records

– Yet there has been no violation of either entity

integrity or referential integrity

1

278Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Duplicate Entries in the JOB Table

1

279Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Boyce-Codd Normal Form (BCNF)

• Every determinant in the table is a candidate

key

– Has same characteristics as primary key, but

for some reason, not chosen to be primary key

• If a table contains only one candidate key, the

3NF and the BCNF are equivalent

• BCNF can be violated only if the table

contains more than one candidate key

1

280Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Boyce-Codd Normal Form (BCNF)

(continued)

• Most designers consider the Boyce-Codd

normal form (BCNF) as a special case of 3NF

• A table is in 3NF if it is in 2NF and there are no

transitive dependencies

• A table can be in 3NF and not be in BCNF

– A transitive dependency exists when one

nonprime attribute is dependent on another

nonprime attribute

– A nonkey attribute is the determinant of a key

attribute

1

281Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Table That is in 3NF but not in BCNF

1

282Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Decomposition to BCNF

1

283Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Sample Data for a BCNF Conversion

1

284Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Another BCNF Decomposition

1

285Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Normalization and Database Design

• Normalization should be part of design process

• Make sure that proposed entities meet required normal form before table structures are created

• Many real-world databases have been improperly designed or burdened with anomalies if improperly modified during course of time

• You may be asked to redesign and modify existing databases

1

286Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Normalization and Database Design

(continued)

• ER diagram

– Provides the big picture, or macro view, of an

organization’s data requirements and

operations

– Created through an iterative process

• Identifying relevant entities, their attributes and

their relationship

• Use results to identify additional entities and

attributes

1

287Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Normalization and Database Design (continued)

• Normalization procedures

– Focus on the characteristics of specific entities

– A micro view of the entities within the ER diagram

• Difficult to separate normalization process

from ER modeling process

• Two techniques should be used concurrently

1

288Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Initial ERD for a

Contracting Company

1

289Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Modified ERD for a

Contracting Company

1

290Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Incorrect Representation

of a M:N Relationship

1

291Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Final (Implementable) ERD for a

Contracting Company

1

292Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Implemented Database for the

Contracting Company

1

293Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Higher-Level Normal Forms

• In some databases, multiple multivalued

attributes exist

1

294Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Tables with Multivalued Dependencies

1

295Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Fourth Normal Form

• Table is in fourth normal form (4NF) if

– It is in 3NF

– Has no multiple sets of multivalued

dependencies

• 4NF is largely academic if tables conform to

the following two rules:

– All attributes are dependent on primary key

but independent of each other

– No row contains two or more multivalued facts

about an entity

1

296Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Set of Tables in 4NF

1

297Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Denormalization

• Creation of normalized relations is important

database design goal

• Processing requirements should also be a

goal

• If tables decomposed to conform to

normalization requirements

– Number of database tables expands

1

298Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Denormalization (continued)

• Joining larger number of tables takes

additional disk input/output (I/O) operations

and processing logic

– Reduces system speed

• Conflicts among design efficiency,

information requirements, and processing

speed are often resolved through

compromises that may include

denormalization

1

299Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Denormalization (continued)

• Unnormalized tables in a production

database tend to have these defects:

– Data updates are less efficient because

programs that read and update tables must

deal with larger tables

– Indexing is much more cumbersome

– Unnormalized tables yield no simple strategies

for creating virtual tables known as views

1

300Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Denormalization (continued)

• Use denormalization cautiously

• Understand why—under some

circumstances—unnormalized tables are a

better choice

1

301Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary

• Normalization is a table design technique

aimed at minimizing data redundancies

• First three normal forms (1NF, 2NF, and 3NF)

are most commonly encountered

• Normalization is an important part—but only a

part—of the design process

• Continue the iterative ER process until all

entities and their attributes are defined and all

equivalent tables are in 3NF

1

302Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• A table in 3NF may contain multivalued

dependencies that produce either numerous

null values or redundant data

• It may be necessary to convert a 3NF table to

the fourth normal form (4NF) by

– splitting such a table to remove multivalued

dependencies

• Tables are sometimes denormalized to yield

less I/O which increases processing speed

1

303

Chapter 6

Introduction to Structured Query

Language (SQL)

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

1

304Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn:

• The basic commands and functions of SQL

• How to use SQL for data administration (to

create tables, indexes, and views)

• How to use SQL for data manipulation (to add,

modify, delete, and retrieve data)

• How to use SQL to query a database to extract

useful information

1

305Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Introduction to SQL

• SQL functions fit into two broad categories:

• Data definition language

– SQL includes commands to create

• Database objects such as tables, indexes, and

views

• Commands to define access rights to those

database objects

• Data manipulation language

– Includes commands to insert, update, delete,

and retrieve data within the database tables

1

306Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Introduction to SQL (continued)

• SQL is relatively easy to learn

• Basic command set has a vocabulary of less

than 100 words

• Nonprocedural language

• American National Standards Institute (ANSI)

prescribes a standard SQL

• Several SQL dialects exist

1

307Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

SQL Data Definition Commands

1

308Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Manipulation Commands

1

309Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Definition Commands

• Examine the simple database model and the

database tables that will form the basis for the

many SQL examples

• Understand the data environment

1

310Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Database Model

1

311Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Creating the Database

• Two tasks must be completed

– create the database structure

– create the tables that will hold the end-user

data

• First task

– RDBMS creates the physical files that will hold

the database

– Tends to differ substantially from one RDBMS

to another

1

312Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Database Schema

• Authentication

– Process through which the DBMS verifies that only registered users are able to access the database

– Log on to the RDBMS using a user ID and a password created by the database administrator

• Schema

– Group of database objects—such as tables and indexes—that are related to each other

1

313Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Types

• Data type selection is usually dictated by the

nature of the data and by the intended use

• Pay close attention to the expected use of

attributes for sorting and data retrieval

purposes

1

314Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Some Common SQL Data Types

1

315Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Creating Table Structures

• Use one line per column (attribute) definition

• Use spaces to line up the attribute characteristics and

constraints

• Table and attribute names are capitalized

• NOT NULL specification

• UNIQUE specification

• Primary key attributes contain both a NOT NULL and a

UNIQUE specification

• RDBMS will automatically enforce referential integrity

for foreign keys

• Command sequence ends with a semicolon

1

316Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Other SQL Constraints

• NOT NULL constraint

– Ensures that a column does not accept nulls

• UNIQUE constraint

– Ensures that all values in a column are unique

• DEFAULT constraint

– Assigns a value to an attribute when a new row is

added to a table

• CHECK constraint

– Validates data when an attribute value is entered

1

317Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

SQL Indexes

• When a primary key is declared, DBMS

automatically creates a unique index

• Often need additional indexes

• Using the CREATE INDEX command, SQL

indexes can be created on the basis of any

selected attribute

• Composite index

– Index based on two or more attributes

– Often used to prevent data duplication

1

318Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Duplicated TEST Record

1

319Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Manipulation Commands

• Adding table rows

• Saving table changes

• Listing table rows

• Updating table rows

• Restoring table contents

• Deleting table rows

• Inserting table rows with a select subquery

1

320Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Common SQL Data Manipulation

Commands

1

321Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Data View and Entry Form

1

322Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Saving Table Changes

• Changes made to table contents are not

physically saved on disk until

– Database is closed

– Program is closed

– COMMIT command is used

• Syntax

– COMMIT [WORK]

• Will permanently save any changes made to

any table in the database

1

323Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Listing Table Rows

• SELECT

– Used to list contents of table

• Syntax

– SELECT columnlistFROM tablename

• Columnlist represents one or more attributes,

separated by commas

• Asterisk can be used as wildcard character to

list all attributes

1

324Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Updating Table Rows

• UPDATE

– Modify data in a table

• Syntax

– UPDATE tablenameSET columnname = expression [, columname = expression]

[WHERE conditionlist];

• If more than one attribute is to be updated in

the row, separate corrections with commas

1

325Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Restoring Table Contents

• ROLLBACK

– Used restore the database to its previous

condition

– Only applicable if COMMIT command has not

been used to permanently store the changes

in the database

• Syntax

– ROLLBACK;

• COMMIT and ROLLBACK only work with

data manipulation commands that are used to

add, modify, or delete table rows

1

326Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Deleting Table Rows

• DELETE

– Deletes a table row

• Syntax

– DELETE FROM tablename[WHERE conditionlist ];

• WHERE condition is optional

• If WHERE condition is not specified, all rows

from the specified table will be deleted

1

327Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Inserting Table Rows with a Select

Subquery

• INSERT

– Inserts multiple rows from another table (source)

– Uses SELECT subquery

• Query that is embedded (or nested) inside another query

• Executed first

• Syntax

– INSERT INTO tablename SELECT columnlist FROM tablename

1

328Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Selecting Rows with Conditional

Restrictions

• Select partial table contents by placing

restrictions on rows to be included in output

– Add conditional restrictions to the SELECT

statement, using WHERE clause

• Syntax

– SELECT columnlistFROM tablelist[ WHERE conditionlist ] ;

1

329Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Selected PRODUCT Table Attributes for

VENDOR Code 21344

1

330Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Microsoft Access QBE and its SQL

1

331Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Comparison Operators

1

332Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Selected PRODUCT Table Attributes for

VENDOR Codes Other than 21344

1

333Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Selected PRODUCT Table Attributes

with a P_PRICE Restriction

1

334Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Selected PRODUCT Table Attributes:

The ASCII Code Effect

1

335Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Selected PRODUCT Table Attributes:

Date Restriction

1

336Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

SELECT Statement

with a Computed Column

1

337Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

SELECT Statement with a Computed

Column and an Alias

1

338Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Arithmetic Operators:

The Rule of Precedence

• Perform operations within parentheses

• Perform power operations

• Perform multiplications and divisions

• Perform additions and subtractions

1

339Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Selected PRODUCT Table Attributes:

The Logical OR

1

340Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Selected PRODUCT Table Attributes:

The Logical AND

1

341Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Selected PRODUCT Table Attributes:

The Logical AND and OR

1

342Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Special Operators

• BETWEEN

– Used to check whether attribute value is within a range

• IS NULL

– Used to check whether attribute value is null

• LIKE

– Used to check whether attribute value matches a given string pattern

• IN

– Used to check whether attribute value matches any value within a value list

• EXISTS

– Used to check if a subquery returns any rows

1

343Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Advanced Data Definition Commands

• All changes in the table structure are made

by using the ALTER command

– Followed by a keyword that produces specific

change

– Three options are available

• ADD

• MODIFY

• DROP

1

344Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Changing a Column’s Data Type

• ALTER can be used to change data type

• Some RDBMSs (such as Oracle) do not

permit changes to data types unless the

column to be changed is empty

1

345Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Changing a Column’s Data

Characteristics

• Use ALTER to change data characteristics

• If the column to be changed already contains

data, changes in the column’s characteristics

are permitted if those changes do not alter

the data type

1

346Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Adding or Dropping a Column

• Use ALTER to add a column

– Do not include the NOT NULL clause for new

column

• Use ALTER to drop a column

– Some RDBMSs impose restrictions on the

deletion of an attribute

1

347Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Effect of Data Entry into the New

P_SALECODE Column

1

348Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Update of the P_SALECODE Column in

Multiple Data Rows

1

349Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Effect of Multiple Data Updates in the

PRODUCT Table (MS Access)

1

350Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Copying Parts of Tables

• SQL permits copying contents of selected

table columns so that the data need not be

reentered manually into newly created

table(s)

• First create the PART table structure

• Next add rows to new PART table using

PRODUCT table rows

1

351Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

PART Attributes Copied

from the PRODUCT Table

1

352Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Advanced Select Queries

• SQL provides useful functions

– Count

– Find minimum and maximum values

– Calculate averages

• SQL allows the user to limit queries to only

those entries having no duplicates or entries

whose duplicates may be grouped

1

353Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Selected PRODUCT Table Attributes:

Ordered by (Ascending) P_PRICE

1

354Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Partial Listing of

EMPLOYEE Table Contents

1

355Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Telephone List Query Results

1

356Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Query Based on Multiple Restrictions

1

357Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Listing of Distinct (Different) V_CODE

Values in the PRODUCT Table

1

358Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Some Basic SQL Aggregate Functions

1

359Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

COUNT Function Output Examples

1

360Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

MAX and MIN Function Output Examples

1

361Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Total Value of All Items

in the PRODUCT Table

1

362Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

AVG Function Output Examples

1

363Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

GROUP BY Clause Output Examples

1

364Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Incorrect and Correct Use

of the GROUP BY Clause

1

365Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

An Application of the HAVING Clause

1

366Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Virtual Tables: Creating a View

• View is a virtual table based on a SELECT

query

– Can contain columns, computed columns,

aliases, and aggregate functions from one or

more tables

• Base tables are tables on which the view is

based

• Create a view by using the CREATE VIEW

command

1

367Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Creating a Virtual Table

with the CREATE VIEW Command

1

368Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Joining Database Tables

• Ability to combine (join) tables on common

attributes is most important distinction

between a relational database and other

databases

• Join is performed when data are retrieved

from more than one table at a time

• Join is generally composed of an equality

comparison between the foreign key and the

primary key of related tables

1

369Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Creating Links Through Foreign Keys

1

370Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Results of a Join

1

371Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

An Ordered and Limited Listing

After a JOIN

1

372Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Contents of the EMP Table

1

373Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Using an Alias to Join a Table to Itself

1

374Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Left Outer Join Results

1

375Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Right Outer Join Results

1

376Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Converting an ER Model

into a Database Structure

• Requires following specific rules that govern

such a conversion

• Decisions made by the designer to govern

data integrity are reflected in the foreign key

rules

• Implementation decisions vary according to

the problem being addressed

1

377Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Ch06_Artist Database ERD

and Tables

1

378Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Data Dictionary

for the Ch06_Artist Database

1

379Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Summary of Foreign Key Rules

1

380Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary

• SQL commands can be divided into two

overall categories:

– Data definition language commands

– Data manipulation language commands

• Basic data definition commands allow you to

create tables, indexes, and views

• Many SQL constraints can be used with

columns

• Aggregate functions

– Special functions that perform arithmetic

computations over a set of rows

1

381Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• ORDER BY clause

– Used to sort output of a SELECT statement

– Can sort by one or more columns and use

either an ascending or descending order

• Join output of multiple tables with SELECT

statement

• Natural join uses join condition to match only

rows with equal values in specified columns

• Right outer join and left outer join used to

select rows that have no matching values in

other related table

1

382

Chapter 7

Advanced SQL

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

1

383Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn:

• About the relational set operators UNION,

UNION ALL, INTERSECT, and MINUS

• How to use the advanced SQL JOIN operator

syntax

• About the different types of subqueries and

correlated queries

• How to use SQL functions to manipulate dates,

strings, and other data

1

384Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn: (continued)

• How to create and use updatable views

• How to create and use triggers and stored

procedures

• How to create embedded SQL

1

385Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

UNION Query Result

1

386Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

UNION ALL Query Result

1

387Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

INTERSECT Query Result

1

388Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

MINUS Query Results

1

389Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

INTERSECT Alternative

1

390Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

MINUS Alternative

1

391Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

SQL Join Expression Styles

1

392Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

NATURAL JOIN Result

1

393Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

JOIN USING Result

1

394Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

JOIN ON Result

1

395Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Outer Joins

• Returns not only rows matching join condition

but also rows with unmatched values

• Three types:

– Left

– Right

– Full

1

396Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

LEFT JOIN Result

1

397Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

RIGHT JOIN Result

1

398Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

FULL JOIN Result

1

399Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

SELECT Subquery Examples

1

400Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

WHERE Subquery Examples

1

401Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

IN Subquery Example

1

402Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

HAVING Subquery Example

1

403Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Multirow Subquery Operator Example

1

404Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

FROM Subquery Example

1

405Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Inline Subquery Example

1

406Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Correlated Subquery Examples

1

407Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

EXISTS Correlated Subquery Examples

1

408Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Selected MS Access/SQL Server

Date/Time Functions

1

409Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Selected Oracle Date/Time Functions

1

410Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Selected Oracle Date/Time Functions

(continued)

1

411Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Selected Oracle Numeric Functions

1

412Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Selected Oracle String Functions

1

413Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Selected Oracle Conversion Functions

1

414Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Selected Oracle Conversion Functions

(continued)

1

415Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Oracle Sequence

1

416Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Oracle Sequence Examples

1

417Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The PRODMASTER

and PRODSALES Tables

1

418Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Oracle UPDATE Error Message

1

419Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Creating an Updatable View in Oracle

1

420Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

PRODMASTER Table Update,

Using an Updatable View

1

421Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Anonymous PL/SQL Block Examples

1

422Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

SHOW ERRORS

• Can help diagnose errors found in PL/SQL

blocks

• Yields additional debugging information

whenever an error is generated after an

PL/SQL block is created or executed

1

423Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Anonymous PL/SQL Block

with Variables and Loops

1

424Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

PL/SQL Basic Data Types

1

425Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The PRODUCT Table

1

426Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Creating the

TRG_PRODUCT_REORDER Trigger

1

427Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Verifying the TRG_PRODUCT_REORDER

Trigger Execution

1

428Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The P_REORDER Value Mismatch After

Update of the P_MIN Attribute

1

429Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Stored Procedures: Advantages

• Substantially reduce network traffic and

increase performance

• No transmission of individual SQL statements

over network

• Help reduce code duplication by means of

code isolation and code sharing

• Minimize chance of errors and cost of

application development and maintenance

1

430Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Creating the PRC_PROD_DISCOUNT

Stored Procedure

1

431Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Results of the PRC_PROD_DISCOUNT

Stored Procedure

1

432Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The PRC_CUS_ADD Stored Procedure

1

433Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The PRC_INV_ADD and

PRC_LINE_ADD Stored Procedures

1

434Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Testing the PRC_INV_ADD and

PRC_LINE_ADD Procedures

1

435Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Cursor Processing Commands

1

436Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Cursor Attributes

1

437Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

SQL and Procedural Languages:

Key Differences

• Run-time mismatch:

– SQL executed one instruction at a time

– Host language typically runs at the client side

in its own memory space

• Processing mismatch:

– Host language processes one data element at

a time

• Data type mismatch:

– Data types may not match

1

438Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Embedded SQL Framework

• A standard syntax to identify embedded SQL

code within host language

• A standard syntax to identify host variables

• A communication area used to exchange

status and error information between SQL

and the host language

1

439Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

SQL Status and Error Reporting Variables

1

440Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Static SQL

• Embedded SQL in which the programmer

used predefined SQL statements and

parameters

– End users of programs are limited to actions

that were specified in application programs

• SQL statements will not change while

application is running

1

441Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Dynamic SQL

• SQL statement is not known in advance, but

instead is generated at run time

• Program can generate SQL statements at run

time that are required to respond to ad hoc

queries

• Attribute list and the condition are not known

until the end user specifies them

• Tends to be much slower than static SQL

• Requires more computer resources

1

442Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary

• SQL provides relational set operators to

combine output of two queries to generate new

relation

• Operations that join tables can be classified as

inner joins and outer joins

• Subqueries and correlated queries are used

when it is necessary to process data based on

other processed data

• SQL functions are used to extract or transform

data

1

443Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• Oracle sequences may be used to generate

values to be assigned to a record

• PL/SQL may be used to create triggers,

stored procedures, and PL/SQL functions

• If SQL statements are designed to return

more than one value inside the PL/SQL code,

a cursor is needed

• Embedded SQL refers to the use of SQL

statements within an application

programming language

1

444

Chapter 8

Database Design

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

1

445Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn:

• That successful database design must reflect the information system of which the database is a part

• That successful information systems are developed within a framework known as the Systems Development Life Cycle (SDLC)

• That, within the information system, the most successful databases are subject to frequent evaluation and revision within a framework known as the Database Life Cycle (DBLC)

1

446Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn (continued):

• How to conduct evaluation and revision within

the SDLC and DBLC frameworks

• What database design strategies exist: top-

down vs. bottom-up design, and centralized

vs. decentralized design

1

447Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Changing Data into Information

• Information

– Data processed and presented in a

meaningful form

– Can be as simple as tabulating the data,

thereby making certain data patterns more

obvious

• Transformation

– Any process that changes data into

information

1

448Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Simple Cross-Classification Table:

Transforming Data into Information

1

449Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Information System

• Provides for data collection, storage, and

retrieval

• Composed of people, hardware, software,

database(s), application programs, and

procedures

• Systems analysis

– Process that establishes need for and extent

of an information system

• Systems development

– Process of creating an information system

1

450Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Applications

• Transform data into information that forms the

basis for decision making

• Usually produce

– Formal report

– Tabulations

– Graphic displays

• Composed of two parts

– Data

– Code by which the data are transformed into

information

1

451Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Generating Information

for Decision Making

1

452Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Information System

• Performance depends on triad of factors:

– Database design and implementation

– Application design and implementation

– Administrative procedures

• Database development

– Process of database design and implementation

– Primary objective is to create complete, normalized, nonredundant (to the extent possible), and fully integrated conceptual, logical, and physical database models

1

453Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Systems Development Life Cycle

(SDLC)

• Traces history (life cycle) of an information

system

• Provides ―big picture‖ within which database

design and application development can be

mapped out and evaluated

1

454Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Systems Development Life Cycle

(SDLC) (continued)

• Divided into five phases

1. Planning

2. Analysis

3. Detailed systems design

4. Implementation

5. Maintenance

• Iterative rather than sequential process

1

455Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Planning

• Yields general overview of the company and

its objectives

• Initial assessment made of information-flow-

and-extent requirements

• Must begin to study and evaluate alternate

solutions

– Technical aspects of hardware and software

requirements

– System cost

1

456Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Systems Development Life Cycle

(SDLC)

1

457Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Analysis

• Problems defined during the planning phase

are examined in greater detail during analysis

• A thorough audit of user requirements

• Existing hardware and software systems are

studied

• Goal is better understanding of system’s

functional areas, actual and potential

problems, and opportunities

1

458Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Logical Systems Design

• Must specify appropriate conceptual data model, inputs, processes, and expected output requirements

• Might use tools such as data flow diagrams (DFD), hierarchical input process output (HIPO) diagrams, or entity relationship (ER) diagrams

• Yields functional descriptions of system’s components (modules) for each process within database environment

1

459Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Detailed Systems Design

• Designer completes design of system’s

processes

• Includes all necessary technical

specifications

• Steps are laid out for conversion from old to

new system

• Training principles and methodologies are

also planned

1

460Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Implementation

• Hardware, DBMS software, and application

programs are installed, and database design

is implemented

• Cycle of coding, testing, and debugging

continues until database is ready to be

delivered

• Database is created and system is

customized by creation of tables and views,

and user authorizations

1

461Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Maintenance

• Three types:

– Corrective maintenance in response to systems errors

– Adaptive maintenance due to changes in the business environment

– Perfective maintenance to enhance the system

• Computer-assisted systems engineering– Make it possible to produce better systems within

reasonable amount of time and at a reasonable cost

1

462Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Database Life Cycle (DBLC)

1

463Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Database Initial Study

• Overall purpose:

– Analyze the company situation

– Define problems and constraints

– Define objectives

– Define scope and boundaries

• Interactive and iterative processes required to

complete the first phase of the DBLC

successfully

1

464Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary of Activities in the Database

Initial Study

1

465Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Analyze the Company Situation

• Analysis

– ―To break up any whole into its parts so as to find out their nature, function, and so on‖

• Company situation

– General conditions in which a company operates, its organizational structure, and its mission

• Analyze the company situation

– Discover what the company’s operational components are, how they function, and how they interact

1

466Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Define Problems and Constraints

• Managerial view of company’s operation is

often different from that of end users

• Designer must continue to carefully probe to

generate additional information that will help

define problems within larger framework of

company operations

• Finding precise answers is important

• Defining problems does not always lead to

the perfect solution

1

467Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Define Objectives

• Designer must ensure that database system

objectives correspond to those envisioned by

end user(s)

• Designer must begin to address the following

questions:

– What is the proposed system’s initial objective?

– Will the system interface with other existing or

future systems in the company?

– Will the system share data with other systems

or users?

1

468Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Define Scope and Boundaries

• Scope

– Defines extent of design according to

operational requirements

– Helps define required data structures, type and

number of entities, and physical size of the

database

• Boundaries

– Limits external to the system

– Often imposed by existing hardware and

software

1

469Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Database Design

• Necessary to concentrate on the data

• Characteristics required to build database

model

• Two views of data within system:

– Business view of data as information source

– Designer’s view of data structure, its access,

and the activities required to transform the

data into information

1

470Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Two Views of Data:

Business Manager and Designer

1

471Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Database Design (continued)

• Loosely related to analysis and design of larger system

• Systems analysts or systems programmers are in charge of designing other system components

– Their activities create procedures that will help transform data within the database into useful information

• Does not constitute a sequential process

– Iterative process that provides continuous feedback designed to trace previous steps

1

472Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Procedure Flow in the Database Design

1

473Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Conceptual Design

• Data modeling used to create an abstract

database structure that represents real-world

objects in the most realistic way possible

• Must embody a clear understanding of the

business and its functional areas

• Ensure that all data needed are in the model,

and that all data in the model are needed

• Requires four steps

1

474Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Analysis and Requirements

• First step is to discover data element

characteristics

– Obtains characteristics from different sources

• Must take into account business rules

– Derived from description of operations

• Document that provides precise, detailed, up-

to-date, and thoroughly reviewed description of

activities that define an organization’s operating

environment

1

475Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Entity Relationship (ER) Modeling

and Normalization

• Designer must communicate and enforce

appropriate standards to be used in the

documentation of design

– Use of diagrams and symbols

– Documentation writing style

– Layout

– Other conventions to be followed during

documentation

1

476Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Developing the Conceptual Model

Using ER Diagrams

1

477Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Composite Entity

1

478Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Redundancies in the VIDEO Table

1

479Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

ER Modeling Is an Iterative Process

Based on Many Activities

1

480Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Conceptual Design Tools

and Information Sources

1

481Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Dictionary

• Defines all objects (entities, attributes,

relations, views, and so on)

• Used in tandem with the normalization

process to help eliminate data anomalies and

redundancy problems

1

482Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Model Verification

• Model must be verified against proposed system

processes to corroborate that intended processes

can be supported by database model

• Revision of original design starts with a careful

reevaluation of entities, followed by a detailed

examination of attributes that describe these

entities

• Define design’s major components as modules:

– An information system component that handles a

specific function

1

483Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The ER Model Verification Process

1

484Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Iterative ER Model Verification Process

1

485Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Verification Process

• Select the central (most important) entity

– Defined in terms of its participation in most of

the model’s relationships

• Identify the module or subsystem to which the

central entity belongs and define boundaries

and scope

• Place central entity within the module’s

framework

1

486Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

DBMS Software Selection

• Critical to the information system’s smooth

operation

• Advantages and disadvantages should be

carefully studied

1

487Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Logical Design

• Used to translate conceptual design into

internal model for a selected database

management system

• Logical design is software-dependent

• Requires that all objects in the model be

mapped to specific constructs used by

selected database software

1

488Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Simple Conceptual Model

1

489Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Sample Layout for the COURSE Table

1

490Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Physical Design

• Process of selecting data storage and data

access characteristics of the database

• Storage characteristics are a function of

device types supported by the hardware, type

of data access methods supported by system,

and DBMS

• Particularly important in the older hierarchical

and network models

• Becomes more complex when data are

distributed at different locations

1

491Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Implementation and Loading

• New database implementation requires the

creation of special storage-related constructs

to house the end-user tables

1

492Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Physical Organization of a DB2 Database

Environment

1

493Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Performance

• One of the most important factors in certain

database implementations

• Not all DBMSs have performance-monitoring

and fine-tuning tools embedded in their

software

• There is no standard measurement for

database performance

• Not only (nor even main) factor

1

494Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Security

• Data must be protected from access by

unauthorized users

• Must provide for the following:

– Physical security

– Password security

– Access rights

– Audit trails

– Data encryption

– Diskless workstations

1

495Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Backup and Recovery

• Database can be subject to data loss through

unintended data deletion and power outages

• Data backup and recovery procedures

– Create a safety valve

– Allow database administrator to ensure

availability of consistent data

1

496Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Integrity

• Enforced through proper use of primary and

foreign key rules

1

497Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Company Standards

• May partially define database standards

• Database administrator must implement and

enforce such standards

1

498Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Concurrency Control

• Feature that allows simultaneous access to a

database while preserving data integrity

• Failure to maintain can quickly destroy a

database’s effectiveness

1

499Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Need for Concurrency Control

1

500Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Testing and Evaluation

• Occurs in parallel with applications

programming

• Database tools used to prototype applications

• If implementation fails to meet some of the

system’s evaluation criteria

– Fine-tune specific system and DBMS

configuration parameters

– Modify the physical design

– Modify the logical design

– Upgrade or change the DBMS software and/or

the hardware platform

1

501Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Operation

• Once the database has passed the

evaluation stage, it is considered operational

• Beginning of the operational phase starts the

process of system evolution

1

502Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Maintenance and Evolution

• Required periodic maintenance:

– Preventive maintenance

– Corrective maintenance

– Adaptive maintenance

• Assignment of access permissions and their

maintenance for new and old users

• Generation of database access statistics

• Periodic security audits

• Periodic system-usage summaries

1

503Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Parallel Activities in the

DBLC and the SDLC

1

504Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Special Note about

Database Design Strategies

• Two classical approaches to database

design:

– Top-down design

• Identifies data sets

• Defines data elements for each of those sets

– Bottom-up design

• Identifies data elements (items)

• Groups them together in data sets

1

505Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Top-Down vs. Bottom-Up Design

Sequencing

1

506Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Centralized vs. Decentralized Design

• Database design may be based on two very different design philosophies:

– Centralized design

• Productive when the data component is composed of a relatively small number of objects and procedures

– Decentralized design

• Used when the data component of system has considerable number of entities and complex relations on which very complex operations are performed

1

507Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Centralized Design

1

508Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Decentralized Design

1

509Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Aggregation Process

• Requires designer to create a single model in

which various aggregation problems must be

addressed:

– Synonyms and homonyms

– Entity and entity subtypes

– Conflicting object definitions

1

510Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary of Aggregation Problems

1

511Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary

• Transformation from data to information is

produced when programming code operates

on the data, thus producing applications

• Information system is designed to facilitate

transformation of data into information and to

manage both data and information

• SDLC traces the history (life cycle) of an

application within the information system

1

512Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• DBLC describes the history of the database

within the information system

• Database design and implementation process

moves through a series of well-defined

stages

• Conceptual portion of the design may be

subject to several variations, based on two

design philosophies

1

513

Chapter 9

Transaction Management and

Concurrency Control

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

1

514Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn:

• What a database transaction is and what its

properties are

• How database transactions are managed

• What concurrency control is and what role it

plays in maintaining the database’s integrity

• What locking methods are and how they work

• How database recovery management is used to

maintain database integrity

1

515Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

What is a Transaction?

• Any action that reads from and/or writes to a database may consist of

– Simple SELECT statement to generate a list of table contents

– A series of related UPDATE statements to change the values of attributes in various tables

– A series of INSERT statements to add rows to one or more tables

– A combination of SELECT, UPDATE, and INSERT statements

1

516Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

What is a Transaction? (continued)

• A logical unit of work that must be either

entirely completed or aborted

• Successful transaction changes the database

from one consistent state to another

– One in which all data integrity constraints are

satisfied

• Most real-world database transactions are

formed by two or more database requests

– The equivalent of a single SQL statement in

an application program or transaction

1

517Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Relational Schema for the

Ch09_SaleCo Database

1

518Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Evaluating Transaction Results

• Not all transactions update the database

• SQL code represents a transaction because database was accessed

• Improper or incomplete transactions can have a devastating effect on database integrity

– Some DBMSs provide means by which user can define enforceable constraints based on business rules

– Other integrity rules are enforced automatically by the DBMS when table structures are properly defined, thereby letting the DBMS validate some transactions

1

519Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Tracing the Transaction in the

Ch09_SaleCo Database

Figure 9.2

1

520Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Transaction Properties

• Atomicity

– Requires that all operations (SQL requests) of

a transaction be completed

• Durability

– Indicates permanence of database’s

consistent state

1

521Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Transaction Properties (continued)

• Serializability

– Ensures that the concurrent execution of

several transactions yields consistent results

• Isolation

– Data used during execution of a transaction

cannot be used by second transaction until

first one is completed

1

522Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Transaction Management with SQL

• ANSI has defined standards that govern SQL

database transactions

• Transaction support is provided by two SQL

statements: COMMIT and ROLLBACK

• ANSI standards require that, when a

transaction sequence is initiated by a user or

an application program,

– it must continue through all succeeding SQL

statements until one of four events occurs

1

523Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Transaction Log

• Stores

– A record for the beginning of transaction

– For each transaction component (SQL statement)

• Type of operation being performed (update, delete, insert)

• Names of objects affected by the transaction (the name of the table)

• ―Before‖ and ―after‖ values for updated fields

• Pointers to previous and next transaction log entries for the same transaction

– The ending (COMMIT) of the transaction

1

524Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Transaction Log

1

525Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Concurrency Control

• Coordination of simultaneous transaction

execution in a multiprocessing database

system

• Objective is to ensure transaction

serializability in a multiuser database

environment

1

526Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Concurrency Control

– Important simultaneous execution of

transactions over a shared database can

create several data integrity and consistency

problems

• lost updates

• uncommitted data

• inconsistent retrievals

1

527Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Normal Execution of Two Transactions

1

528Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Lost Updates

1

529Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Correct Execution of Two Transactions

1

530Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

An Uncommitted Data Problem

1

531Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Retrieval During Update

1

532Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Transaction Results:

Data Entry Correction

1

533Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Inconsistent Retrievals

1

534Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Scheduler

• Special DBMS program: establishes order of

operations within which concurrent

transactions are executed

• Interleaves the execution of database

operations to ensure serializability and

isolation of transactions

1

535Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Scheduler (continued)

• Bases its actions on concurrency control

algorithms

• Ensures computer’s central processing unit

(CPU) is used efficiently

• Facilitates data isolation to ensure that two

transactions do not update the same data

element at the same time

1

536Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Read/Write Conflict Scenarios:

Conflicting Database Operations Matrix

1

537Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Concurrency Control

with Locking Methods

• Lock

– Guarantees exclusive use of a data item to a

current transaction

– Required to prevent another transaction from

reading inconsistent data

• Lock manager

– Responsible for assigning and policing the

locks used by the transactions

1

538Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Lock Granularity

• Indicates the level of lock use

• Locking can take place at the following levels:

– Database

– Table

– Page

– Row

– Field (attribute)

1

539Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Lock Granularity (continued)

• Database-level lock

– Entire database is locked

• Table-level lock

– Entire table is locked

• Page-level lock

– Entire diskpage is locked

1

540Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Lock Granularity (continued)

• Row-level lock

– Allows concurrent transactions to access

different rows of the same table, even if the

rows are located on the same page

• Field-level lock

– Allows concurrent transactions to access the

same row, as long as they require the use of

different fields (attributes) within that row

1

541Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Database-Level Locking Sequence

1

542Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

An Example of a Table-Level Lock

1

543Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Example of a Page-Level Lock

1

544Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

An Example of a Row-Level Lock

1

545Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Lock Types

• Binary lock

– Has only two states: locked (1) or unlocked (0)

• Exclusive lock

– Access is specifically reserved for the

transaction that locked the object

– Must be used when the potential for conflict

exists

• Shared lock

– Concurrent transactions are granted Read

access on the basis of a common lock

1

546Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

An Example of a Binary Lock

1

547Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Two-Phase Locking

to Ensure Serializability

• Defines how transactions acquire and relinquish locks

• Guarantees serializability, but it does not prevent deadlocks

– Growing phase, in which a transaction acquires all the required locks without unlocking any data

– Shrinking phase, in which a transaction releases all locks and cannot obtain any new lock

1

548Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Two-Phase Locking

to Ensure Serializability (continued)

• Governed by the following rules:

– Two transactions cannot have conflicting locks

– No unlock operation can precede a lock

operation in the same transaction

– No data are affected until all locks are

obtained—that is, until the transaction is in its

locked point

1

549Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Two-Phase Locking Protocol

1

550Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Deadlocks

• Condition that occurs when two transactions

wait for each other to unlock data

• Possible only if one of the transactions wants

to obtain an exclusive lock on a data item

– No deadlock condition can exist among

shared locks

• Control through

– Prevention

– Detection

– Avoidance

1

551Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

How a Deadlock Condition Is Created

1

552Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Concurrency Control

with Time Stamping Methods

• Assigns a global unique time stamp to each

transaction

• Produces an explicit order in which

transactions are submitted to the DBMS

• Uniqueness

– Ensures that no equal time stamp values can

exist

• Monotonicity

– Ensures that time stamp values always

increase

1

553Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Wait/Die and Wound/Wait Schemes

• Wait/die

– Older transaction waits and the younger is

rolled back and rescheduled

• Wound/wait

– Older transaction rolls back the younger

transaction and reschedules it

1

554Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Wait/Die and Wound/Wait

Concurrency Control Schemes

1

555Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Concurrency Control

with Optimistic Methods

• Optimistic approach

– Based on the assumption that the majority of

database operations do not conflict

– Does not require locking or time stamping

techniques

– Transaction is executed without restrictions

until it is committed

– Phases are read, validation, and write

1

556Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Database Recovery Management

• Database recovery

– Restores database from a given state, usually

inconsistent, to a previously consistent state

– Based on the atomic transaction property

• All portions of the transaction must be treated

as a single logical unit of work, in which all

operations must be applied and completed to

produce a consistent database

– If transaction operation cannot be completed,

transaction must be aborted, and any changes

to the database must be rolled back (undone)

1

557Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Transaction Recovery

• Makes use of deferred-write and write-

through

• Deferred write

– Transaction operations do not immediately

update the physical database

– Only the transaction log is updated

– Database is physically updated only after the

transaction reaches its commit point using the

transaction log information

1

558Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Transaction Recovery (continued)

• Write-through

– Database is immediately updated by

transaction operations during the transaction’s

execution, even before the transaction

reaches its commit point

1

559Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Transaction Log for Transaction

Recovery Examples

1

560Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary

• Transaction

– Sequence of database operations that access

the database

– Represents real-world events

– Must be a logical unit of work

• No portion of the transaction can exist by itself

– Takes a database from one consistent state to

another

• One in which all data integrity constraints are

satisfied

1

561Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• SQL provides support for transactions

through the use of two statements: COMMIT

and ROLLBACK

• Concurrency control coordinates the

simultaneous execution of transactions

• Scheduler is responsible for establishing

order in which concurrent transaction

operations are executed

1

562Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• Lock guarantees unique access to a data

item by a transaction

• Database recovery restores the database

from a given state to a previous consistent

state

1

563

Chapter 10

Distributed Database

Management Systems

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

1

564Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn:

• What a distributed database management system (DDBMS) is and what its components are

• How database implementation is affected by different levels of data and process distribution

• How transactions are managed in a distributed database environment

• How database design is affected by the distributed database environment

1

565Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Evolution of Distributed Database

Management Systems

• Distributed database management system

(DDBMS)

– Governs storage and processing of logically

related data over interconnected computer

systems in which both data and processing

functions are distributed among several sites

1

566Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Evolution of Distributed Database

Management Systems (continued)

• Centralized database required that corporate

data be stored in a single central site

• Dynamic business environment and

centralized database’s shortcomings

spawned a demand for applications based on

data access from different sources at multiple

locations

1

567Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Centralized Database Management

System

1

568Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

DDBMS Advantages

• Data are located near ―greatest demand‖ site

• Faster data access

• Faster data processing

• Growth facilitation

• Improved communications

• Reduced operating costs

• User-friendly interface

• Less danger of a single-point failure

• Processor independence

1

569Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

DDBMS Disadvantages

• Complexity of management and control

• Security

• Lack of standards

• Increased storage requirements

• Greater difficulty in managing the data

environment

• Increased training cost

1

570Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Distributed Processing Environment

1

571Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Distributed Database Environment

1

572Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Characteristics of Distributed

Management Systems

• Application interface

• Validation

• Transformation

• Query optimization

• Mapping

• I/O interface

• Formatting

• Security

• Backup and recovery

• DB administration

• Concurrency control

• Transaction management

1

573Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Characteristics of Distributed

Management Systems (continued)

• Must perform all the functions of a centralized

DBMS

• Must handle all necessary functions imposed

by the distribution of data and processing

• Must perform these additional functions

transparently to the end user

1

574Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Fully Distributed Database

Management System

1

575Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

DDBMS Components

• Must include (at least) the following components:

– Computer workstations

– Network hardware and software

– Communications media

– Transaction processor (or, application processor, or transaction manager)

• Software component found in each computer that requests data

– Data processor or data manager

• Software component residing on each computer that stores and retrieves data located at the site

• May be a centralized DBMS

1

576Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Distributed Database System

Components

1

577Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Database Systems: Levels of Data and

Process Distribution

1

578Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Single-Site Processing, Single-Site Data

(SPSD)

• All processing is done on single CPU or host computer (mainframe, midrange, or PC)

• All data are stored on host computer’s local disk

• Processing cannot be done on end user’s side of the system

• Typical of most mainframe and midrange computer DBMSs

• DBMS is located on the host computer, which is accessed by dumb terminals connected to it

• Also typical of the first generation of single-user microcomputer databases

1

579Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Single-Site Processing, Single-Site Data

(Centralized)

1

580Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Multiple-Site Processing, Single-Site Data

(MPSD)

• Multiple processes run on different computers

sharing a single data repository

• MPSD scenario requires a network file server

running conventional applications that are

accessed through a LAN

• Many multi-user accounting applications,

running under a personal computer network,

fit such a description

1

581Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Multiple-Site Processing, Single-Site Data

1

582Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Multiple-Site Processing,

Multiple-Site Data (MPMD)

• Fully distributed database management system

with support for multiple data processors and

transaction processors at multiple sites

• Classified as either homogeneous or

heterogeneous

• Homogeneous DDBMSs

– Integrate only one type of centralized DBMS

over a network

1

583Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Multiple-Site Processing,

Multiple-Site Data (MPMD) (continued)

• Heterogeneous DDBMSs

– Integrate different types of centralized DBMSs

over a network

• Fully heterogeneous DDBMS

– Support different DBMSs that may even support

different data models (relational, hierarchical, or

network) running under different computer

systems, such as mainframes and

microcomputers

1

584Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Heterogeneous Distributed

Database Scenario

1

585Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Distributed Database

Transparency Features

• Allow end user to feel like database’s only

user

• Features include:

– Distribution transparency

– Transaction transparency

– Failure transparency

– Performance transparency

– Heterogeneity transparency

1

586Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Distribution Transparency

• Allows management of a physically dispersed

database as though it were a centralized

database

• Three levels of distribution transparency are

recognized:

– Fragmentation transparency

– Location transparency

– Local mapping transparency

1

587Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Summary of Transparency Features

1

588Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Fragment Locations

1

589Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Transaction Transparency

• Ensures database transactions will maintain

distributed database’s integrity and

consistency

1

590Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Distributed Requests and Distributed

Transactions

• Distributed transaction

– Can update or request data from several different remote sites on a network

• Remote request

– Lets a single SQL statement access data to be processed by a single remote database processor

• Remote transaction

– Accesses data at a single remote site

1

591Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Distributed Requests and Distributed

Transactions (continued)

• Distributed transaction

– Allows a transaction to reference several

different (local or remote) DP sites

• Distributed request

– Lets a single SQL statement reference data

located at several different local or remote DP

sites

1

592Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Remote Request

1

593Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Remote Transaction

1

594Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Distributed Transaction

1

595Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Distributed Request

1

596Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Another Distributed Request

1

597Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Distributed Concurrency Control

• Multisite, multiple-process operations are

much more likely to create data

inconsistencies and deadlocked transactions

than are single-site systems

1

598Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Effect of a Premature COMMIT

1

599Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Two-Phase Commit Protocol

• Distributed databases make it possible for a

transaction to access data at several sites

• Final COMMIT must not be issued until all

sites have committed their parts of the

transaction

• Two-phase commit protocol requires each

individual DP’s transaction log entry be

written before the database fragment is

actually updated

1

600Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Performance Transparency

and Query Optimization

• Objective of query optimization routine is to

minimize total cost associated with the

execution of a request

• Costs associated with a request are a

function of the:

– Access time (I/O) cost

– Communication cost

– CPU time cost

1

601Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Performance Transparency

and Query Optimization (continued)

• Must provide distribution transparency as well

as replica transparency

• Replica transparency:

– DDBMS’s ability to hide the existence of

multiple copies of data from the user

• Query optimization techniques:

– Manual or automatic

– Static or dynamic

– Statistically based or rule-based algorithms

1

602Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Distributed Database Design

• Data fragmentation:

– How to partition the database into fragments

• Data replication:

– Which fragments to replicate

• Data allocation:

– Where to locate those fragments and replicas

1

603Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Fragmentation

• Breaks single object into two or more

segments or fragments

• Each fragment can be stored at any site over

a computer network

• Information about data fragmentation is

stored in the distributed data catalog (DDC),

from which it is accessed by the TP to

process user requests

1

604Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Fragmentation Strategies

• Horizontal fragmentation:

– Division of a relation into subsets (fragments)

of tuples (rows)

• Vertical fragmentation:

– Division of a relation into attribute (column)

subsets

• Mixed fragmentation:

– Combination of horizontal and vertical

strategies

1

605Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Sample CUSTOMER Table

1

606Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Horizontal Fragmentation of the

CUSTOMER Table by State

1

607Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Table Fragments in Three Locations

1

608Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Vertically Fragmented Table Contents

1

609Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Mixed Fragmentation of the

CUSTOMER Table

1

610Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Replication

• Storage of data copies at multiple sites served

by a computer network

• Fragment copies can be stored at several sites

to serve specific information requirements

– Can enhance data availability and response time

– Can help to reduce communication and total

query costs

1

611Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Table Contents After the Mixed

Fragmentation Process

1

612Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Replication

1

613Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Replication Scenarios

• Fully replicated database:– Stores multiple copies of each database

fragment at multiple sites

– Can be impractical due to amount of overhead

• Partially replicated database:– Stores multiple copies of some database

fragments at multiple sites

– Most DDBMSs are able to handle the partially replicated database well

• Unreplicated database:

– Stores each database fragment at a single site

– No duplicate database fragments

1

614Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Allocation

• Deciding where to locate data

• Allocation strategies:– Centralized data allocation

• Entire database is stored at one site

– Partitioned data allocation• Database is divided into several disjointed parts

(fragments) and stored at several sites

– Replicated data allocation• Copies of one or more database fragments are

stored at several sites

• Data distribution over a computer network is achieved through data partition, data replication, or a combination of both

1

615Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Client/Server vs. DDBMS

• Way in which computers interact to form a

system

• Features a user of resources, or a client, and

a provider of resources, or a server

• Can be used to implement a DBMS in which

the client is the TP and the server is the DP

1

616Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Client/Server Advantages

• Less expensive than alternate minicomputer or mainframe solutions

• Allow end user to use microcomputer’s GUI, thereby improving functionality and simplicity

• More people with PC skills than with mainframe skills in the job market

• PC is well established in the workplace

• Numerous data analysis and query tools exist to facilitate interaction with DBMSs available in the PC market

• Considerable cost advantage to offloading applications development from the mainframe to powerful PCs

1

617Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Client/Server Disadvantages

• Creates a more complex environment, in which

different platforms (LANs, operating systems,

and so on) are often difficult to manage

• An increase in the number of users and

processing sites often paves the way for security

problems

• Possible to spread data access to a much wider

circle of users increases demand for people

with broad knowledge of computers and

software increases burden of training and cost

of maintaining the environment

1

618Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

C. J. Date’s Twelve Commandments for

Distributed Databases

1. Local site independence

2. Central site independence

3. Failure independence

4. Location transparency

5. Fragmentation transparency

6. Replication transparency

7. Distributed query processing

8. Distributed transaction processing

9. Hardware independence

10. Operating system independence

11. Network independence

12. Database independence

1

619Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary

• Distributed database stores logically related

data in two or more physically independent

sites connected via a computer network

• Database is divided into fragments

• Distributed databases require distributed

processing

• Main components of a DDBMS are the

transaction processor and the data processor

1

620Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• Current database systems can be classified by extent to which they support processing and data distribution

• DDBMS characteristics are best described as a set of transparencies

• A transaction is formed by one or more database requests

• A database can be replicated over several different sites on a computer network

• Client/server architecture refers to the way in which two computers interact over a computer network to form a system

1

621

Chapter 11

Object Oriented Databases

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

1

622Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn:

• What basic concepts govern OO systems

• How OO features are related to the more

traditional relational and ER models

• What the basic features of an OO database

management system (OODBMS) are

• What effect OO concepts are likely to have on

data modeling and design

1

623Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn: (continued)

• About the advantages and disadvantages of

OODBMSs

• How OO concepts have influenced the

relational model

• How Oracle9i implements object extensions

1

624Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Object Orientation and Its Benefits

• A set of design and development principles

based on conceptually autonomous computer

structures known as objects

• Each object represents a real-world entity

with the ability to act upon itself and interact

with other objects

• Modularity is therefore almost inevitable

1

625Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Object Orientation Contributions

1

626Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Evolution of Object Oriented

Concepts

• Object oriented programming

– Developed as an alternative to traditional

programming methods

– Programmer creates or uses objects:

• Self-contained, reusable modules that contain

data as well as the procedures used to operate

on such data

1

627Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Evolution of Object Oriented

Concepts (continued)

• Object oriented programming languages were developed to:

– Provide an easy-to-use software development environment

– Provide a powerful software modeling tool for application development

– Decrease development time by reducing the amount of code

– Improve programmer productivity by making that code reusable

1

628Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Evolution of Object Oriented

Concepts (continued)

• Object oriented environment has several

important attributes:

– Data set is no longer passive

– Data and procedures are bound together,

creating an object

– Object has an innate ability to act on itself

1

629Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Object Oriented Concepts

• Have their roots in programming languages

• No knowledge of programming is necessary

to understand these concepts

1

630Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Objects: Components and Characteristics

• Object:

– Abstract representation of a real-world entity

– Has:

• Unique identity

• Embedded properties

• Ability to interact with other objects and act

upon itself

– Defining characteristic is its unique identity

1

631Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Real-World Student Objects

1

632Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Object Identity

• Unique to that object

• Assigned by system at moment of object’s

creation

• Cannot be changed under any circumstances

• Can be deleted only if the object is deleted

• Can never be reused

1

633Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Attributes (Instance Variables)

• Attributes:

– Known as instance variables in OO

environment

• Domain:

– Logically groups and describes the set of all

possible values that an attribute can have

1

634Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Object Attributes

1

635Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Object State

• Set of values that object’s attributes have at a

given time

• Can vary, although its OID remains the same

• To change the object’s state, change the

values of the object’s attributes

• To change the object’s attribute values, send

a message to the object

– Message will invoke a method

1

636Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Messages and Methods

• Method:

– Code that performs a specific operation on

object’s data

– Protects data from direct and unauthorized

access by other objects

– Used to change the object’s attribute values or

to return the value of selected object attributes

– Represent real-world actions

1

637Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Depiction of an Object

1

638Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Method Components

1

639Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Objects Send Messages to Each Other

1

640Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Classes

• Collection of similar objects with shared

structure (attributes) and behavior (methods)

• Class instance or object instance

– Each object in a class

1

641Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Class Illustration

1

642Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Protocol

• An object’s public aspect

• How it is known by other objects as well as

end users

• Other objects communicate with the student

object using any of these methods

1

643Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Public and Private Aspects of an Object

1

644Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

OO Summary: Object Characteristics

1

645Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Musical Instruments Class Hierarchy

1

646Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Single Inheritance

1

647Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Multiple Inheritance

1

648Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Motor Vehicle and Bicycle Instance

Variables

1

649Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Employee Class Hierarchy Method

Override

1

650Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Employee Class Hierarchy Polymorphism

1

651Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Abstract Data Types

• Differs from conventional data type

– ADT’s operations are user-defined

– ADT does not allow direct access to its

internal data representation or method

implementation

• To create ADT, specify:

– Its name

– Data representation or instance variables of

objects belonging to the abstract data

– ADT operations and constraints, both of

which are implemented through methods

1

652Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Object Classification

• Simple object

• Composite object

• Compound object

• Hybrid object

• Associative object

1

653Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Characteristics of an Object Oriented

Data Model

• Support the representation of complex

objects

• Are extensible:

– Capable of defining new data types as well as

the operations to be performed on them

• Support encapsulation:

– Data representation and method’s

implementation must be hidden from external

entities

1

654Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Characteristics of an Object Oriented

Data Model (continued)

• Exhibit inheritance:

– Object must be able to inherit properties (data

and methods) of other objects

• Support the notion of object identity (OID)

1

655Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Comparing the OO and ER Model

Components

1

656Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Shared Representation for All Objects of

the Class Person

1

657Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

State of a Person Object Instance

1

658Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Defining Three Abstract Data Types

1

659Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Object Representation for Instances of

the Class Person with ADTs

1

660Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Object State for an Instance of the Class

Person, Using ADTs

1

661Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Referential Object Sharing

1

662Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Class Hierarchy

1

663Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Employee Object Representation

1

664Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Class Hierarchy for the EDLP Retail

Corporation

1

665Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Representing a 1:M Relationship

1

666Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Representing 1:1 and 1:M Relationships

1

667Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Employee-Dependent Relationship

1

668Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Representing the M:N Relationship

1

669Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Representing the M:N Relationship with

Associated Attributes

1

670Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Representing the M:N Relationship with

Intersection Class

1

671Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Object Space Representation

1

672Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Late and Early Binding:

Use and Importance

• Late binding:

– Data type of an attribute is not known until

execution time or runtime

– Two different object instances of the same

class can contain values of different data

types for the same attribute

• Early binding:

– Allows database to check data type for each of

the attribute’s values at compilation or

definition time

1

673Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

INVENTORY Table with Predetermined

(Base) Data Types

1

674Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Inventory Class with Early Binding

1

675Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

OODM Inventory Class with Late Binding

1

676Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Support for Versioning

• Allows users to track history of changes in

state of an object

• If the changes do not yield expected results,

they can be undone and the component

restored to its original state

• Reason OODBMS is such a strong player in

the CAD and computer-aided manufacturing

(CAM) arenas

1

677Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

OODM and Previous Data Models:

Similarities and Differences

• OODM object resembles entity and tuple in the ER and relational models but has additional characteristics

• Class

• Hierarchies

• Encapsulation

• Object ID (OID) not supported

• Relationships

• OODM produces a schema in which relations form part of the structure of the database

1

678Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

An Invoice Representation

1

679Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Object Oriented Database Management

Systems

• Integrate benefits of typical database systems

with the more powerful modeling and

computational (programming) characteristics

of the object oriented data model

• Used to develop complex systems

1

680Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Object Oriented Database Management

Systems

• Result of combining OO features, such as– class inheritance

– encapsulation, and

– polymorphism,

• With database features such as– data integrity, -- data manipulation,

– security, -- system tuning and

– persistence, -- recovery

– transaction management,

– concurrency control,

– backup,

1

681Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Object Oriented Database Management

Systems

1

682Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Thirteen OODBMS Rules

1

683Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

How Object Orientation

Affects Database Design

• Relational and ER models sometimes cannot adequately represent some objects

• Operations are not a part of the database model

• Object oriented design requires the database description to include objects and their data representation, constraints, and operations

• Few computerized OODB design tools exist

• Lack of standards affects object oriented database design

1

684Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

OODBMS:

Advantages and Disadvantages

• OODBMS occupies a strong niche market

• Vehicle for technological innovation

• Has not been the beneficiary of market share

growth

1

685Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

How OO Concepts Have Influenced the

Relational Model

• RDBMS is beginning to reach its limits in a

business data environment that is changing

with the advent of mixed-media data storage

and retrieval

1

686Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

How OO Concepts Have Influenced the

Relational Model

• Extended relational model (ERM), or

object/relational model (O/RM)

– Extensibility of new user-defined (abstract)

data types

– Complex objects

– Inheritance

– Procedure calls (rules or triggers)

– System-generated identifiers (OID surrogates)

1

687Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Next Generation of Database

Management Systems

• Likely to incorporate features borrowed from

object oriented database systems, artificial

intelligence systems, expert systems,

distributed databases, and the Internet

• Enable future DBMSs to handle more

complex problems with both normalized and

nonnormalized data

• OODBMS will probably continue to occupy a

niche within the database market

1

688Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary

• Object oriented concepts are derived from OO

programming languages

• An object is a conceptual representation of a

real-world entity

• Similar objects are grouped in classes

• Classes are organized into a class hierarchy

• Abstract data types are implemented through

classes

• The OO data model allows the designer to create

a more authentic representation of real-world

objects

1

689Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• OODBMSs combine OO features with

database features

• OODBMSs yield several benefits over

conventional DBMSs

– more semantic information in the database

– support for complex objects

– better performance in complex applications

– reusability of classes

– extensibility of the data types supported by the

database

1

690

Chapter 12

The Data Warehouse

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

1

691Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn:

• How operational data and decision support

data differ

• What a data warehouse is and how data for it

are prepared

• What star schemas are and how they are

constructed

• What steps are required to successfully

implement a data warehouse

• What data mining is and what role it plays in

decision support

1

692Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Need for Data Analysis

• Managers must be able to track daily

transactions to evaluate how the business is

performing

• By tapping into the operational database,

management can develop strategies to meet

organizational goals

• Data analysis can provide information about

short-term tactical evaluations and strategies

1

693Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Solving Business Problems and Adding

Value with Data Warehouse-Based Solutions

1

694Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Solving Business Problems and Adding Value

with Data Warehouse-Based Solutions (continued)

1

695Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Decision Support Systems

• Methodology (or series of methodologies) designed to extract information from data and to use such information as a basis for decision making

• Decision support system (DSS):– Arrangement of computerized tools used to assist

managerial decision making within a business

– Usually requires extensive data ―massaging‖ to produce information

– Used at all levels within an organization

– Often tailored to focus on specific business areas

– Provides ad hoc query tools to retrieve data and to display data in different formats

1

696Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Decision Support Systems (continued)

• Composed of four main components:

– Data store component

• Basically a DSS database

– Data extraction and filtering component

• Used to extract and validate data taken from operational database and external data sources

– End-user query tool

• Used to create queries that access database

– End-user presentation tool

• Used to organize and present data

1

697Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Main Components of a

Decision Support System (DSS)

1

698Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Transforming Operational Data Into

Decision Support Data

1

699Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Contrasting Operational and DSS Data

Characteristics

1

700Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Ten-Year Sales History for a Single

Department, in Millions of Dollars

1

701Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Yearly Sales Summaries, Two Stores and Two

Departments per Store,

in Millions of Dollars

1

702Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Data Warehouse

• Integrated, subject-oriented, time-variant,

nonvolatile database that provides support for

decision making

1

703Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Comparison of Data Warehouse and

Operational Database Characteristics

1

704Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Creating a Data Warehouse

1

705Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

DSS Architectural Styles

1

706Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Online Analytical Processing

• Advanced data analysis environment that

supports decision making, business

modeling, and operations research

• OLAP systems share four main

characteristics:

– Use multidimensional data analysis

techniques

– Provide advanced database support

– Provide easy-to-use end-user interfaces

– Support client/server architecture

1

707Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Operational vs. Multidimensional

View of Sales

1

708Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Integration of OLAP

with a Spreadsheet Program

1

709Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

OLAP Client/Server Architecture

1

710Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

OLAP Server Arrangement

1

711Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

OLAP Server with Multidimensional Data

Store Arrangement

1

712Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

OLAP Server With Local Mini Data Marts

1

713Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Bitmap Representation of REGION

Values

1

714Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Typical ROLAP Client/Server Architecture

1

715Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

MOLAP Client/Server Architecture

1

716Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Relational vs. Multidimensional OLAP

1

717Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Star Schemas

• Data modeling technique used to map multidimensional decision support data into a relational database

• Creates the near equivalent of a multidimensional database schema from the existing relational database

• Yield an easily implemented model for multidimensional data analysis, while still preserving the relational structures on which the operational database is built

• Has four components: facts, dimensions, attributes, and attribute hierarchies

1

718Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Simple Star Schema

1

719Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Possible Attributes for Sales Dimensions

1

720Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Three-Dimensional View of Sales

1

721Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Slice and Dice View of Sales

1

722Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Location Attribute Hierarchy

1

723Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Attribute Hierarchies In Multidimensional

Analysis

1

724Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Star Schema for Sales

1

725Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Orders Star Schema

1

726Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Normalized Dimension tables

1

727Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Multiple Fact Tables

1

728Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Implementing a Data Warehouse

• Numerous constraints:

– Available funding

– Management’s view of the role played by an

IS department and of the extent and depth of

the information requirements

– Corporate culture

• No single formula can describe perfect data

warehouse development

1

729Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Factors Common to Data Warehousing • Data warehouse is not a static database

• Dynamic framework for decision support that is always a work in progress

• Data warehouse data cross departmental lines and geographical boundaries

• Must satisfy:

– Data integration and loading criteria

– Data analysis capabilities with acceptable query performance

– End-user data analysis needs

• Apply database design procedures

1

730Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Warehouse

Implementation Road Map

1

731Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data Mining

• Tools that:

– analyze data

– uncover problems or opportunities hidden in

data relationships,

– form computer models based on their findings,

and then

– use the models to predict business behavior

• Require minimal end-user intervention

1

732Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Extraction of Knowledge From Data

1

733Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data-Mining Phases

1

734Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Sample of Current Data Warehousing

and Data-Mining Vendors

1

735Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary

• Data analysis is used to derive and interpret information from data

• Decision support is a methodology designed to extract information from data and to use such information as a basis for decision making

• Decision support system is an arrangement of computerized tools used to assist managerial decision making within a business

• Data warehouse is an integrated, subject-oriented, time-variant, nonvolatile database that provides support for decision making

1

736Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• Online analytical processing is an advanced

data analysis environment that supports

decision making, business modeling, and

operations research

• Star schema is a data-modeling technique used

to map multidimensional decision support data

into a relational database

• The implementation of any company-wide

information system is subject to conflicting

organizational and behavioral factors

1

737Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• Data mining automates analysis of operational

data with the intention of finding previously

unknown data characteristics, relationships,

dependencies, and/or trends

• Data warehouse is storage location for decision

support data

1

738

Chapter 13

Databases in Electronic Commerce

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

1

739Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn:

• What electronic commerce (e-commerce) is

• About the effect of e-commerce and its

benefits and disadvantages

• About the different electronic commerce styles

• About the Internet architectural components

required to conduct electronic commerce

1

740Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn: (continued)

• About database design and implementation

issues for electronic commerce applications

• What Extensible Markup Language (XML) is

and why it is important

1

741Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Orbitz E-Commerce Web Site

1

742Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

What is Electronic Commerce?

• Use of electronic networked computer-based technology to:

– Bring new products, services, or ideas to market

– Support and enhance business operations (including sales of products/services over the Web)

• Most e-commerce transactions take place among businesses

• Now recognized as a prime revenue source

1

743Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Road to Electronic Commerce

• Key to e-commerce is using computer networks, especially the Internet, to automate and streamline business transactions

• 1960s: banks created private telephone network to do electronic funds transfers

• 1970s: banks created services to provide afterhours services to their customers

• Late 1970s and early 1980s: Electronic Data Interchange (EDI) emerged

– Communications protocol that enabled companies to exchange business documents over private phone networks

1

744Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Road to Electronic Commerce

(continued)

• Early 1980s and through the 1990s: personal

computer facilitated rapid expansion of the

Internet and ultimately provided the spark that

led to the explosive use of the World Wide

Web

• Late 1990s and early 2000s: networking

technologies blossomed and expanded the

reach, speed, and in some cases, security of

Internet-based communications and

transactions

1

745Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Amazon.com Home Page

1

746Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Impact of E-commerce

• Majority of businesses have a presence on

the Web

• Global market has attracted millions of

businesses and organizations to the Internet

and e-commerce

• E-commerce enables businesses to provide

services to customers, partners, employees,

and the general public

• Internet is driving the development of a new

generation of information systems

1

747Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

E-Commerce Benefits

• Easy comparison shopping

• Reduced costs and increased competition

• Convenience

• 24 × 7 × 365 operation

• Global access

• Lower entry barriers

• Increased market (customer) knowledge

1

748Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

E-Commerce Disadvantages

• Hidden costs

• Vulnerability to technical failure

• Cost of staying in business

• Lack of security

• Invasion of privacy

• Low service levels

• Legal issues

1

749Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

E-commerce Styles

• Transactions can be grouped according to the sellers and buyers:

– Business to business (B2B)

• Electronic commerce between businesses

– Business to consumer (B2C)

• Electronic commerce between business and consumers

– Intra-business

• Internal electronic commerce activities, most of which involve interactions between employers and employees

1

750Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

E-Commerce Styles

1

751Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

E-Commerce Automation of Supply Chain

1

752Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Covisint.com: Automotive B2B

Marketplace

1

753Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Sample B2C Web Sites

1

754Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

E-commerce Architecture

• Deployment of a well-planned architecture is

necessary to support e-commerce business

transactions, both internal and external

• E-commerce architecture can be divided into

a series of layers:

– Basic Internet services

– Business-enabling services

– E-commerce business services

1

755Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

E-Commerce Architecture

1

756Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Internet Building Blocks and Basic

Services

1

757Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Internet Building Blocks and Basic

Services (continued)

1

758Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Basic Internet Services

1

759Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Business-Enabling Services

1

760Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Business-Enabling Services (continued)

1

761Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Security

• Encompasses all the activities related to

protecting data and other e-commerce

components against accidental or intentional

(usually illegal) access or use by

unauthorized users

• Privacy

– Deals with the rights of individuals and

organizations to determine the ―who, what,

when, where, and how‖ of data use

1

762Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Security (continued)

• Security (procedures and technology) must

be maintained to:

– Authenticate identity of transaction participants

– Protect transaction data from unauthorized

modifications

– Protect resources (data and computers)

1

763Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Sample E-Commerce Transaction

1

764Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Registering with a Certification Authority

1

765Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Web Browser Security Settings

1

766Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Web Browser Secure Session

1

767Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Web Browser Proxy Settings

1

768Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Web Payment Processing

• Key function of e-commerce Web sites is their ability to

process online payments for products and/or services

– Digital cash

• Digital equivalent of hard currency

– Online credit card processing

– Electronic wallets

• Equivalent of a physical wallet—can contain credit

card information, digital cash, and other personal

information such as shipping addresses, phone

numbers, and e-mail addresses

1

769Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Setting Up a Microsoft Electronic Wallet

1

770Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Database Design for E-commerce

Applications

• Define scope of database

• Establish some basic business rules and their

effect(s) on the design

• Define tables required to support the e-

commerce activities

• Identify basic attributes for each table

1

771Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Main Tables for E-Commerce Database

1

772Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

CUSTOMER Table

1

773Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

CUSTOMER Table (Continued)

1

774Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

PRODUCT Table

1

775Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

PRODUCT Table (Continued)

1

776Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

PRODTYPE Table

1

777Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

ORDER Table

1

778Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

ORDER Table (Continued)

1

779Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

ORDLINE Table

1

780Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

SHOPCART Table

1

781Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

PMTTYPE Table

1

782Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

SHIPTYPE Table

1

783Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

TAXRATE Table

1

784Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

STATE Table

1

785Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

PROMOTION Table

1

786Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

PRICEWATCH Table

1

787Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

PRODPRICE Table

1

788Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Extensible Markup Language (XML)

• Meta-language used to represent and

manipulate data elements

• Designed to facilitate the exchange of

structured documents such as orders or

invoices over the Internet

• World Wide Web Consortium published the

first XML 1.0 standard definition in 1998

1

789Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Contents of the ProductList.xml

Document

1

790Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Contents of the ProductList.dtd Document

1

791Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Contents of the ProductListv2.xml

Document

1

792Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

DTD and XML Documents for Order Data

1

793Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The XML Schema Document for the

Order Data

1

794Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Framework for XML Transformations

1

795Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Displaying XML Documents in MSIE 5.0

1

796Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

XML Data Binding in MSIE 5.0

1

797Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary

• E-commerce is the use of electronic

computer-based technology to

– bring new products, services, or ideas to

market, and to

– support enhanced business operations

• E-commerce enables companies to market

and sell products and/or services to a global

market of millions of users

1

798Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• Adoption of e-commerce technologies

enables companies to provide rapid

responses to competitive pressures by

enhancing internal operations and facilitating

business transactions

• E-commerce can be classified as business to

business (B2B), business to consumer (B2C),

and intra-business

1

799Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• E-commerce architecture provides a

framework that describes the technical

components of e-commerce Web sites and

their interactions

• Security and privacy of business transactions

and data are crucial for the success of e-

commerce

• Credit card processing and digital cash are

the most common ways to process payments

on the Internet

1

800Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• E-commerce databases contain normalized

structures that are similar to typical

operational databases

• Extensible Markup Language (XML)

facilitates the exchange of B2B data over the

Internet

1

801

Chapter 14

Web Database Development

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

1

802Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn:

• How Internet databases are typically used

• About the architecture of Web-to-database

middleware

• How Web-to-database middleware

(ColdFusion) is used to integrate databases

with the Internet

• What special considerations govern Web

database development

1

803Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Internet Technologies and Databases

• Web database connectivity allows new

innovative services that:

– Allow rapid response to competitive pressures

by bringing new services and products to

market quickly

– Increase customer satisfaction through

creation of Web-based support services

– Yield fast and effective information

dissemination through universal access from

across the street or across the globe

1

804Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Characteristics and Benefits

of Internet Technologies

1

805Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Typical Uses of Internet Databases

• Share information businesses are willing to make public

• Shared information is likely to be based on non-critical data

• Provide marketing and customer support

• Provide corporate information to users inside the company (intranets)

• Provide relevant information to users of another company with which the company does business (extranets)

• Develop applications

1

806Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Sample of Applications That Use Web-

Database Technology

1

807Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Web-to-Database Middleware:

Server-side Extensions

• Also known as Web-to-database middleware

• Program that interacts directly with Web

server to handle specific types of requests

• Provides its services to the Web server in a

way that is totally transparent to the client

browser

1

808Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Web-to-Database Middleware

(ColdFusion)

1

809Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Web Server Interfaces

1

810Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Windows Applications Use ODBC to

Access Databases

1

811Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Web-to-Database Middleware Uses

ODBC to Access Databases

1

812Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Web Browser

• Software that lets users navigate (browse) the

Web

• Located in client computer

• End-user interface to the World Wide Web

• Interprets HTML code received from Web

server

• Presents different page components in a

standard way

1

813Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Client-side Extensions

• Client-side extensions

– Add functionality to Web browser

– Three general types:

• Plug-ins

• Java and JavaScript

• ActiveX and VBScript

1

814Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Using a Web-to-Database

Production Tool: ColdFusion

• Web application server:

– Middleware application that expands Web

server functionality by linking it to a wide range

of services

– Provides consistent run-time environment for

Web applications

1

815Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Using a Web-to-Database

Production Tool: ColdFusion (continued)

• ColdFusion application middleware can be

used to:

– Connect to and query a database from a Web

page

– Present database data in a Web page, using

various formats

– Create dynamic Web search pages

– Create Web pages to insert, update, and

delete database data

1

816Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Using a Web-to-Database

Production Tool: ColdFusion (continued)

– Define required and optional relationships

– Define required and optional form fields

– Enforce referential integrity in form fields

– Use simple and nested queries and form

select fields to represent business rules

1

817Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

How ColdFusion Works

1

818Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Ch14_RobCor Database’s Relational

Schema

1

819Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Simple Query Using CFQUERY and

CFOUTPUT

1

820Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The rc-1.cfm Script Output

(Vertical Listing)

1

821Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

CFQUERY with Tabular CFOUTPUT

1

822Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The rc-2.cfm Script Output

(Horizontal Listing)

1

823Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

CFQUERY with CFTABLE

1

824Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The rc-3.cfm Script Output

(Formatted Horizontal Listing)

1

825Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Dynamic Search Query:

Criteria Entry Form

1

826Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The rc-4a.cfm Script Output

(State Search Criteria Entry Form)

1

827Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The VENDOR Search Results

1

828Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The rc-4b.cfm Script Output

(Vendor Search Results: All States)

1

829Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Vendor List for the Condition

VEN_STATE = ―GA‖

1

830Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Insert Query: Data Entry Script

1

831Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The rc-5a.cfm Script Output

(Department Data Entry Screen)

1

832Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Insert Query Form:

Server-Side Validation Error Message

1

833Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Insert Query: Confirmation Script

1

834Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The rc-5b.cfm Script Output

(Department Data Entry Confirmation)

1

835Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Insert Query:

ODBC Integrity Violation Error

1

836Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Update Query: Record Selection Script

1

837Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The rc-6a.cfm Script Output

(Record Selection Screen)

1

838Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Update Query: Edit Record Script

1

839Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The rc-6b.cfm Script Output

(Edit Record Screen)

1

840Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Update Query: Result Confirmation Script

1

841Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The rc-6c.cfm Script Output

(Update Query Result Confirmation)

1

842Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Delete Query: Record Selection Script

1

843Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The rc-7a.cfm Script Output

(Record Selection Screen)

1

844Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Delete Query: Show Record Script

1

845Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The rc-7b.cfm Script Output

(Show Record Screen)

1

846Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Delete Query: Result Confirmation Script

1

847Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The rc-7c.cfm Script Output

(Delete Query Confirmation Screen)

1

848Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Delete Record Validation

1

849Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Internet Database Systems:

Special Considerations

• Internet database systems involve more than

just the development of database-enabled

Web applications

• Database systems development requires

sound database design and implementation

• Concurrent database access by multiple

heterogeneous clients affects how

transactions are defined and managed

1

850Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Internet Database Systems:

Special Considerations (continued)

• If database systems are to be developed and

managed intelligently, today’s database

administrator must understand the Internet-

based business environment to successfully

cope with the issues that drive the

development, use, and management of Web-

to-database interfaces

1

851Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary

• Internet is a worldwide network of computers

running the TCP/IP suite of network protocols

• Web server provides standard interfaces

such as the Common Gateway Interface

(CGI) and the application programming

interface (API)

• Database access through the Web is

achieved through database-to-middleware

software

1

852Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• ColdFusion is a Web application server that

provides database access (among other

services) to the Web

• Developing applications for the

Internet/intranets/extranets means

overcoming limitations of the Web interface

1

853

Chapter 15

Database Administration

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

1

854Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn:

• That data are a valuable business asset that

requires careful management

• Why and how the database plays a critical

role in an organization

• That the introduction of a DBMS has

important technological, managerial, and

cultural organizational consequences

1

855Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

In this chapter, you will learn: (continued)

• What the database administrator’s

managerial and technical roles are

• About several database administration tools

• About various database administration

strategies

• How various database administration

technical tasks are performed with Oracle

1

856Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Data as a Corporate Asset

• Data are accepted as a valuable asset

requiring careful management

• Data are now well understood as a valuable

resource to be translated into information

• If information is accurate and timely, its use is

likely to enhance company’s competitive

position and generate wealth

1

857Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Fig 15.1 The Data-Information-Decision-

Making Cycle

1

858Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Need for and Role of Databases

in an Organization

• Database’s predominant role is to support

managerial decision making at all levels in

the organization

• DBMS must provide tools that give each level

of management a different view of the data

and support required level of decision making

1

859Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Introduction of a Database:

Special Considerations

• Having a computerized database

management system does not guarantee that

the data will be properly used to provide best

solutions required by managers

1

860Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Introduction of a Database:

Special Considerations (continued)

• Introduction of a DBMS is likely to have a

profound impact, which might be positive or

negative, depending on how it is administered

• Three important aspects

– Technological: DBMS software and hardware

– Managerial: Administrative functions

– Cultural: Corporate resistance to change

1

861Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Evolution of the Database

Administration Function

• Data administration has its roots in the old, decentralized world of the file system

• Advent of the DBMS and its shared view of data produced a new level of data management sophistication and led the DP department to evolve into an information systems (IS) department

• Data management became an increasingly complex job, thus leading to development of the database administration function

1

862Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The IS Department Internal Organization

1

863Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Placement of the DBA Function

1

864Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A DBA Functional Organization

1

865Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Multiple Database Administrators

in an Organization

1

866Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Database Environment’s

Human Component

• Even the most carefully crafted database

system cannot operate without a human

component

• Effective data administration requires both

technical and managerial skills

• DA must set data administration goals

• DBA is the focal point for data/user interaction

• Need for diverse mix of skills

1

867Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Contrasting DA and DBA Activities

and Characteristics

1

868Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

A Summary of DBA Activities

1

869Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Desired DBA Skills

1

870Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

DBA Activities and Services

1

871Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Database Administration Tools

• Two main types of data dictionaries:

– Integrated

– Standalone

• Main function: store description of all objects

that interact with the database

1

872Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Database Administration Tools (continued)

• Possible to manage use and allocation of all

organization’s information, regardless of

whether it has roots in database data

• Metadata stored in data dictionary are often

basis for monitoring database use and

assignment of access rights to database

users

1

873Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

An Example of a CASE Tool:

Visio Professional

1

874Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Developing a Database

Administration Strategy

• Critical step for any organization is to ensure

its information system supports strategic

plans for each of the company’s business

areas

• Database administration strategy must not

conflict with information systems plans

1

875Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Developing a Database

Administration Strategy (continued)

• Information engineering

– Translates strategic company goals into the

data and applications that will help company

achieve those goals

– Output of the IE process is an information

systems architecture that serves as basis for

planning, development, and control of future

information systems

1

876Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Forces Affecting the Development

of the ISA

1

877Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The DBA at Work:

Using Oracle for Database Administration

• Execution of tasks tends to be DBMS-and

operating-system specific

• Brief introduction to the way some typical

DBA tasks would be performed in Oracle

1

878Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Oracle Enterprise Manager Interface

1

879Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Oracle Edit Local Preferred

Credentials Window

1

880Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Oracle RDBMS Services

1

881Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Oracle Storage Manager

1

882Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Creating a New Tablespace

1

883Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Oracle Schema Manager

1

884Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Oracle Security Manager

1

885Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Create User Dialog Box

1

886Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

The Oracle Instance Manager

1

887Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Creating a New Database with the

Database Configuration Assistant

1

888Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Selecting the New Database Template

1

889Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Naming the Database

1

890Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Selecting the Database Operation Mode

1

891Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Specifying Initialization Parameters

1

892Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Specifying Storage Parameters

1

893Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Database Creation Options

1

894Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary of Database Creation Options

1

895Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Database Creation Progress

1

896Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary• Data management is critical for any

organization

• Data should be treated as corporate asset with monetary value

• DBMS is most commonly used electronic tool for corporate data management

• Impact of the DBMS on the organization’s managerial and cultural framework must be carefully examined

• Data administration function was developed in response to changes in data management fostered by technological advances in computer systems

1

897Database Systems: Design, Implementation, & Management, 6th Edition, Rob & Coronel

Summary (continued)

• Database administrator (DBA) is responsible for corporate database management

• Broader data management activity is handled by data administrator (DA)

• DA is more managerially oriented than the more technically oriented DBA

• Development of data administration strategy is closely related to the company’s mission and objectives

• Implementing the overall company strategy is a crucial process influenced by managerial, technological, and cultural issues