897
1 1 Chapter 1 Database Systems Database Systems: Design, Implementation, and Management, Sixth Edition, Rob and Coronel

Database Systems

Embed Size (px)

DESCRIPTION

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

Citation preview

Page 1: Database Systems

1

1

Chapter 1

Database Systems

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

Page 2: Database Systems

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

Page 3: Database 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

Page 4: Database Systems

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

Page 5: Database Systems

1

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

Sales per Employee for Each of

ROBCOR’s Two Divisions

Page 6: Database Systems

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)

Page 7: Database Systems

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

Page 8: Database Systems

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

Page 9: Database Systems

1

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

The DBMS Manages the Interaction

Between the End User and the Database

Page 10: Database Systems

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

Page 11: Database Systems

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

Page 12: Database Systems

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

Page 13: Database Systems

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

Page 14: Database Systems

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

Page 15: Database Systems

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

Page 16: Database Systems

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

Page 17: Database Systems

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)

Page 18: Database Systems

1

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

Contents of Customer File

Page 19: Database Systems

1

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

Basic File Terminology

Page 20: Database Systems

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

Page 21: Database Systems

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

Page 22: Database Systems

1

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

Contents of the Agent File

Page 23: Database Systems

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

Page 24: Database Systems

1

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

A Simple File System

Page 25: Database Systems

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

Page 26: Database Systems

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

Page 27: Database Systems

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

Page 28: Database Systems

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

Page 29: Database Systems

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

Page 30: Database Systems

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

Page 31: Database Systems

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

Page 32: Database Systems

1

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

Sample Customer File Fields

Page 33: Database Systems

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

Page 34: Database Systems

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

Page 35: Database Systems

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

Page 36: Database Systems

1

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

Contrasting Database and File Systems

Page 37: Database 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

Page 38: Database Systems

1

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

The Database System Environment

(continued)

Page 39: Database Systems

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

Page 40: Database Systems

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

Page 41: Database Systems

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

Page 42: Database Systems

1

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

Illustrating Metadata

with Microsoft Access

Page 43: Database Systems

1

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

Illustrating Data Storage Management

with Oracle

Page 44: Database Systems

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

Page 45: Database Systems

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

Page 46: Database Systems

1

46

Chapter 2

Data Model

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

Page 47: Database Systems

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

Page 48: Database Systems

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

Page 49: Database Systems

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

Page 50: Database Systems

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

Page 51: Database Systems

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

Page 52: Database Systems

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

Page 53: Database Systems

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

Page 54: Database Systems

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

Page 55: Database Systems

1

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

The Evolution of Data Models

• Hierarchical

• Network

• Relational

• Entity relationship

• Object oriented

Page 56: Database Systems

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

Page 57: Database Systems

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

Page 58: Database Systems

1

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

A Hierarchical Structure

Page 59: Database Systems

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

Page 60: Database Systems

1

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

The Hierarchical Model

• Advantages

– Conceptual simplicity

– Database security

– Data independence

– Database integrity

– Efficiency

Page 61: Database Systems

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

Page 62: Database Systems

1

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

Child with Multiple Parents

Page 63: Database Systems

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)

Page 64: Database Systems

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

Page 65: Database Systems

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

Page 66: Database Systems

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

Page 67: Database Systems

1

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

A Network Data Model

Page 68: Database Systems

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

Page 69: Database Systems

1

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

The Network Data Model (continued)

• Disadvantages

– System complexity

– Lack of structural independence

Page 70: Database Systems

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

Page 71: Database Systems

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

Page 72: Database Systems

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

Page 73: Database Systems

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

Page 74: Database Systems

1

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

A Relational Schema

Page 75: Database Systems

1

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

Linking Relational Tables

Page 76: Database Systems

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

Page 77: Database Systems

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

Page 78: Database Systems

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

Page 79: Database Systems

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

Page 80: Database Systems

1

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

Relationships: The Basic Chen ERD

Page 81: Database Systems

1

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

Relationships:

The Basic Crow’s Foot ERD

Page 82: Database Systems

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

Page 83: Database Systems

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

Page 84: Database Systems

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)

Page 85: Database Systems

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

Page 86: Database Systems

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

Page 87: Database Systems

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

Page 88: Database Systems

1

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

A Comparison of the OO Model

and the ER Model

Page 89: Database Systems

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

Page 90: Database Systems

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

Page 91: Database Systems

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

Page 92: Database Systems

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

Page 93: Database Systems

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

Page 94: Database Systems

1

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

The Development of Data Models

Page 95: Database Systems

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

Page 96: Database Systems

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

Page 97: Database Systems

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

Page 98: Database Systems

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

Page 99: Database Systems

1

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

Data Abstraction Levels

Page 100: Database Systems

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

Page 101: Database Systems

1

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

A Conceptual Model for Tiny College

Page 102: Database Systems

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

Page 103: Database Systems

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

Page 104: Database Systems

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

Page 105: Database Systems

1

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

A Division of an Internal Model into

External Models

Page 106: Database Systems

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

Page 107: Database Systems

1

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

The External Model

• DBMS dependent

• Hardware independent

Page 108: Database Systems

1

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

The External Models for Tiny College

Page 109: Database Systems

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

Page 110: Database Systems

1

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

Levels of Data Abstraction

Page 111: Database Systems

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

Page 112: Database Systems

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

Page 113: Database Systems

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

Page 114: Database Systems

1

114

Chapter 3

The Relational Database Model

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

Page 115: Database Systems

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

Page 116: Database Systems

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

Page 117: Database Systems

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

Page 118: Database Systems

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

Page 119: Database Systems

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

Page 120: Database Systems

1

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

Characteristics of a Relational Table

Table 3.1

Page 121: Database Systems

1

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

STUDENT Table Attribute Values

Page 122: Database Systems

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

Page 123: Database Systems

1

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

Student Classification

Page 124: Database Systems

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

Page 125: Database Systems

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

Page 126: Database Systems

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

Page 127: Database Systems

1

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

An Example of a

Simple Relational Database

Page 128: Database Systems

1

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

The Relational Schema for the

CH03_SaleCo Database

Page 129: Database Systems

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

Page 130: Database Systems

1

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

Relational Database Keys

Page 131: Database Systems

1

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

Integrity Rules

Page 132: Database Systems

1

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

An Illustration of Integrity Rules

Page 133: Database Systems

1

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

A Dummy Variable Value Used as a Flag

Page 134: Database Systems

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

Page 135: Database Systems

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

Page 136: Database Systems

1

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

Union

Page 137: Database Systems

1

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

Intersect

Page 138: Database Systems

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

Page 139: Database Systems

1

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

Difference

Page 140: Database Systems

1

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

Product

Page 141: Database Systems

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

Page 142: Database Systems

1

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

Select

Page 143: Database Systems

1

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

Project

Page 144: Database Systems

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

Page 145: Database Systems

1

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

Two Tables That Will Be Used

in Join Illustrations

Page 146: Database Systems

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

Page 147: Database Systems

1

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

Natural Join, Step 1: PRODUCT

Page 148: Database Systems

1

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

Natural Join, Step 2: SELECT

Page 149: Database Systems

1

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

Natural Join, Step 3: PROJECT

Page 150: Database Systems

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

Page 151: Database Systems

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

Page 152: Database Systems

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

Page 153: Database Systems

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

Page 154: Database Systems

1

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

Left Outer Join

Page 155: Database Systems

1

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

Right Outer Join

Page 156: Database Systems

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

Page 157: Database Systems

1

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

DIVIDE

Page 158: Database Systems

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

Page 159: Database Systems

1

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

A Sample Data Dictionary

Page 160: Database Systems

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

Page 161: Database Systems

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

Page 162: Database Systems

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

Page 163: Database Systems

1

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

The 1:1 Relationship Between

PROFESSOR and DEPARTMENT

Page 164: Database Systems

1

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

The Implemented 1:1 Relationship Between

PROFESSOR and DEPARTMENT

Page 165: Database Systems

1

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

The 1:M Relationship

Between PAINTER and PAINTING

Page 166: Database Systems

1

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

The Implemented 1:M Relationship

Between PAINTER and PAINTING

Page 167: Database Systems

1

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

The 1:M Relationship

Between COURSE and CLASS

Page 168: Database Systems

1

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

The Implemented 1:M Relationship

Between COURSE and CLASS

Page 169: Database Systems

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

Page 170: Database Systems

1

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

The ERD’s M:N Relationship

Between STUDENT and CLASS

Page 171: Database Systems

1

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

Sample Student Enrollment Data

Page 172: Database Systems

1

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

The M:N Relationship

Between STUDENT and CLASS

Page 173: Database Systems

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

Page 174: Database Systems

1

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

Converting the M:N Relationship

into Two 1:M Relationships

Page 175: Database Systems

1

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

Changing the M:N Relationship

to Two 1:M Relationships

Page 176: Database Systems

1

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

The Expanded Entity Relationship Model

Page 177: Database Systems

1

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

The Relational Schema for the

Ch03_TinyCollege Database

Page 178: Database Systems

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

Page 179: Database Systems

1

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

A Small Invoicing System

Page 180: Database Systems

1

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

The Relational Schema

for the Invoicing System

Page 181: Database Systems

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

Page 182: Database Systems

1

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

Components of an Index

Page 183: Database Systems

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

Page 184: Database Systems

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

Page 185: Database Systems

1

185

Chapter 4

Entity Relationship (ER) Modeling

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

Page 186: Database Systems

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

Page 187: Database Systems

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

Page 188: Database Systems

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

Page 189: Database Systems

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

Page 190: Database Systems

1

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

The Attributes of the STUDENT Entity

Page 191: Database Systems

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

Page 192: Database Systems

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

Page 193: Database Systems

1

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

The CLASS Table (Entity)

Components and Contents

Page 194: Database Systems

1

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

Attributes

• Composite attribute

• Simple attribute

• Single-value attribute

• Multivalued attributes

Page 195: Database Systems

1

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

A Multivalued Attribute in an Entity

Page 196: Database Systems

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

Page 197: Database Systems

1

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

Splitting the Multivalued

Attribute into New Attributes

Page 198: Database Systems

1

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

Components of the Multivalued Attribute

Page 199: Database Systems

1

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

A New Entity Set Composed of a

Multivalued Attribute’s Components

Page 200: Database Systems

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

Page 201: Database Systems

1

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

Depiction of a Derived Attribute

Page 202: Database Systems

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

Page 203: Database Systems

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

Page 204: Database Systems

1

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

Connectivity and Cardinality in an ERD

Page 205: Database Systems

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

Page 206: Database Systems

1

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

A Weak (Non-Identifying) Relationship

Between COURSE and CLASS

Page 207: Database Systems

1

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

A Weak Relationship

Between COURSE and CLASS

Page 208: Database Systems

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

Page 209: Database Systems

1

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

A Strong (Identifying) Relationship

Between COURSE and CLASS

Page 210: Database Systems

1

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

An Optional CLASS Entity in the Relationship

PROFESSOR teaches CLASS

Page 211: Database Systems

1

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

COURSE and CLASS

in a Mandatory Relationship

Page 212: Database Systems

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

Page 213: Database Systems

1

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

A Weak Entity in an ERD

Page 214: Database Systems

1

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

A Weak Entity in a Strong Relationship

Page 215: Database Systems

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

Page 216: Database Systems

1

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

Three Types of Relationships

Page 217: Database Systems

1

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

The Implementation

of a Ternary Relationship

Page 218: Database Systems

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

Page 219: Database Systems

1

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

An ER Representation

of Recursive Relationships

Page 220: Database Systems

1

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

The 1:1 Recursive Relationship

―EMPLOYEE is Married to EMPLOYEE‖

Page 221: Database Systems

1

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

Implementation of the M:N Recursive

―PART Contains PART‖ Relationship

Page 222: Database Systems

1

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

Implementation of the 1:M ―EMPLOYEE

Manages EMPLOYEE‖ Recursive Relationship

Page 223: Database Systems

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

Page 224: Database Systems

1

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

Converting the M:N Relationship

into Two 1:M Relationships

Page 225: Database Systems

1

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

The M:N Relationship

Between STUDENT and CLASS

Page 226: Database Systems

1

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

A Composite Entity in an ERD

Page 227: Database Systems

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

Page 228: Database Systems

1

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

Nulls Created by Unique Attributes

Page 229: Database Systems

1

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

A Generalization Hierarchy

Page 230: Database Systems

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

Page 231: Database Systems

1

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

The EMPLOYEE/PILOT

Supertype/Subtype Relationship

Page 232: Database Systems

1

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

A Generalization Hierarchy

with Overlapping Subtypes

Page 233: Database Systems

1

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

A Comparison of ER Modeling Symbols

Page 234: Database Systems

1

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

The Chen Representation

of the Invoicing Problem

Page 235: Database Systems

1

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

The Crow’s Foot Representation

of the Invoicing Problem

Page 236: Database Systems

1

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

The Rein85 Representation

of the Invoicing Problem

Page 237: Database Systems

1

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

The IDEF1X Representation

of the Invoicing Problem

Page 238: Database Systems

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

Page 239: Database Systems

1

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

A Supertype/Subtype Relationship

Page 240: Database Systems

1

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

A Supertype/Subtype Relationship

in an ERD

Page 241: Database Systems

1

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

Components of the ER Model

Page 242: Database Systems

1

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

The Completed Tiny College ERD

Page 243: Database Systems

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

Page 244: Database Systems

1

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

Various Implementations

of a 1:1 Recursive Relationship

Page 245: Database Systems

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

Page 246: Database Systems

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

Page 247: Database Systems

1

247

Chapter 5

Normalization of Database Tables

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

Page 248: Database Systems

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

Page 249: Database Systems

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)

Page 250: Database Systems

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

Page 251: Database Systems

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

Page 252: Database Systems

1

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

A Sample Report Layout

Page 253: Database Systems

1

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

A Table in the Report Format

Page 254: Database Systems

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

Page 255: Database Systems

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

Page 256: Database Systems

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

Page 257: Database Systems

1

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

Data Organization: First Normal Form

Page 258: Database Systems

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

Page 259: Database Systems

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

Page 260: Database Systems

1

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

A Dependency Diagram:

First Normal Form (1NF)

Page 261: Database Systems

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

Page 262: Database Systems

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

Page 263: Database Systems

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

Page 264: Database Systems

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

Page 265: Database Systems

1

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

Second Normal Form (2NF)

Conversion Results

Page 266: Database Systems

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

Page 267: Database Systems

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

Page 268: Database Systems

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

Page 269: Database Systems

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

Page 270: Database Systems

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

Page 271: Database Systems

1

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

Third Normal Form (3NF)

Conversion Results

Page 272: Database Systems

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

Page 273: Database Systems

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

Page 274: Database Systems

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

Page 275: Database Systems

1

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

The Completed Database

Page 276: Database Systems

1

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

The Completed Database (continued)

Page 277: Database Systems

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

Page 278: Database Systems

1

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

Duplicate Entries in the JOB Table

Page 279: Database Systems

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

Page 280: Database Systems

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

Page 281: Database Systems

1

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

A Table That is in 3NF but not in BCNF

Page 282: Database Systems

1

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

Decomposition to BCNF

Page 283: Database Systems

1

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

Sample Data for a BCNF Conversion

Page 284: Database Systems

1

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

Another BCNF Decomposition

Page 285: Database Systems

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

Page 286: Database Systems

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

Page 287: Database Systems

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

Page 288: Database Systems

1

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

The Initial ERD for a

Contracting Company

Page 289: Database Systems

1

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

The Modified ERD for a

Contracting Company

Page 290: Database Systems

1

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

The Incorrect Representation

of a M:N Relationship

Page 291: Database Systems

1

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

The Final (Implementable) ERD for a

Contracting Company

Page 292: Database Systems

1

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

The Implemented Database for the

Contracting Company

Page 293: Database Systems

1

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

Higher-Level Normal Forms

• In some databases, multiple multivalued

attributes exist

Page 294: Database Systems

1

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

Tables with Multivalued Dependencies

Page 295: Database Systems

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

Page 296: Database Systems

1

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

A Set of Tables in 4NF

Page 297: Database Systems

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

Page 298: Database Systems

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

Page 299: Database Systems

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

Page 300: Database Systems

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

Page 301: Database Systems

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

Page 302: Database Systems

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

Page 303: Database Systems

1

303

Chapter 6

Introduction to Structured Query

Language (SQL)

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

Page 304: Database Systems

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

Page 305: Database Systems

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

Page 306: Database Systems

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

Page 307: Database Systems

1

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

SQL Data Definition Commands

Page 308: Database Systems

1

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

Data Manipulation Commands

Page 309: Database Systems

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

Page 310: Database Systems

1

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

The Database Model

Page 311: Database Systems

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

Page 312: Database Systems

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

Page 313: Database Systems

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

Page 314: Database Systems

1

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

Some Common SQL Data Types

Page 315: Database Systems

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

Page 316: Database Systems

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

Page 317: Database Systems

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

Page 318: Database Systems

1

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

A Duplicated TEST Record

Page 319: Database Systems

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

Page 320: Database Systems

1

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

Common SQL Data Manipulation

Commands

Page 321: Database Systems

1

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

A Data View and Entry Form

Page 322: Database Systems

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

Page 323: Database Systems

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

Page 324: Database Systems

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

Page 325: Database Systems

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

Page 326: Database Systems

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

Page 327: Database Systems

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

Page 328: Database Systems

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 ] ;

Page 329: Database Systems

1

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

Selected PRODUCT Table Attributes for

VENDOR Code 21344

Page 330: Database Systems

1

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

The Microsoft Access QBE and its SQL

Page 331: Database Systems

1

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

Comparison Operators

Page 332: Database Systems

1

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

Selected PRODUCT Table Attributes for

VENDOR Codes Other than 21344

Page 333: Database Systems

1

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

Selected PRODUCT Table Attributes

with a P_PRICE Restriction

Page 334: Database Systems

1

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

Selected PRODUCT Table Attributes:

The ASCII Code Effect

Page 335: Database Systems

1

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

Selected PRODUCT Table Attributes:

Date Restriction

Page 336: Database Systems

1

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

SELECT Statement

with a Computed Column

Page 337: Database Systems

1

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

SELECT Statement with a Computed

Column and an Alias

Page 338: Database Systems

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

Page 339: Database Systems

1

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

Selected PRODUCT Table Attributes:

The Logical OR

Page 340: Database Systems

1

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

Selected PRODUCT Table Attributes:

The Logical AND

Page 341: Database Systems

1

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

Selected PRODUCT Table Attributes:

The Logical AND and OR

Page 342: Database Systems

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

Page 343: Database Systems

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

Page 344: Database Systems

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

Page 345: Database Systems

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

Page 346: Database Systems

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

Page 347: Database Systems

1

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

The Effect of Data Entry into the New

P_SALECODE Column

Page 348: Database Systems

1

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

Update of the P_SALECODE Column in

Multiple Data Rows

Page 349: Database Systems

1

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

The Effect of Multiple Data Updates in the

PRODUCT Table (MS Access)

Page 350: Database Systems

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

Page 351: Database Systems

1

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

PART Attributes Copied

from the PRODUCT Table

Page 352: Database Systems

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

Page 353: Database Systems

1

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

Selected PRODUCT Table Attributes:

Ordered by (Ascending) P_PRICE

Page 354: Database Systems

1

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

Partial Listing of

EMPLOYEE Table Contents

Page 355: Database Systems

1

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

Telephone List Query Results

Page 356: Database Systems

1

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

A Query Based on Multiple Restrictions

Page 357: Database Systems

1

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

A Listing of Distinct (Different) V_CODE

Values in the PRODUCT Table

Page 358: Database Systems

1

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

Some Basic SQL Aggregate Functions

Page 359: Database Systems

1

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

COUNT Function Output Examples

Page 360: Database Systems

1

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

MAX and MIN Function Output Examples

Page 361: Database Systems

1

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

The Total Value of All Items

in the PRODUCT Table

Page 362: Database Systems

1

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

AVG Function Output Examples

Page 363: Database Systems

1

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

GROUP BY Clause Output Examples

Page 364: Database Systems

1

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

Incorrect and Correct Use

of the GROUP BY Clause

Page 365: Database Systems

1

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

An Application of the HAVING Clause

Page 366: Database Systems

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

Page 367: Database Systems

1

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

Creating a Virtual Table

with the CREATE VIEW Command

Page 368: Database Systems

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

Page 369: Database Systems

1

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

Creating Links Through Foreign Keys

Page 370: Database Systems

1

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

The Results of a Join

Page 371: Database Systems

1

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

An Ordered and Limited Listing

After a JOIN

Page 372: Database Systems

1

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

The Contents of the EMP Table

Page 373: Database Systems

1

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

Using an Alias to Join a Table to Itself

Page 374: Database Systems

1

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

The Left Outer Join Results

Page 375: Database Systems

1

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

The Right Outer Join Results

Page 376: Database Systems

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

Page 377: Database Systems

1

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

The Ch06_Artist Database ERD

and Tables

Page 378: Database Systems

1

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

A Data Dictionary

for the Ch06_Artist Database

Page 379: Database Systems

1

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

A Summary of Foreign Key Rules

Page 380: Database Systems

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

Page 381: Database Systems

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

Page 382: Database Systems

1

382

Chapter 7

Advanced SQL

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

Page 383: Database Systems

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

Page 384: Database Systems

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

Page 385: Database Systems

1

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

UNION Query Result

Page 386: Database Systems

1

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

UNION ALL Query Result

Page 387: Database Systems

1

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

INTERSECT Query Result

Page 388: Database Systems

1

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

MINUS Query Results

Page 389: Database Systems

1

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

INTERSECT Alternative

Page 390: Database Systems

1

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

MINUS Alternative

Page 391: Database Systems

1

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

SQL Join Expression Styles

Page 392: Database Systems

1

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

NATURAL JOIN Result

Page 393: Database Systems

1

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

JOIN USING Result

Page 394: Database Systems

1

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

JOIN ON Result

Page 395: Database Systems

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

Page 396: Database Systems

1

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

LEFT JOIN Result

Page 397: Database Systems

1

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

RIGHT JOIN Result

Page 398: Database Systems

1

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

FULL JOIN Result

Page 399: Database Systems

1

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

SELECT Subquery Examples

Page 400: Database Systems

1

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

WHERE Subquery Examples

Page 401: Database Systems

1

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

IN Subquery Example

Page 402: Database Systems

1

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

HAVING Subquery Example

Page 403: Database Systems

1

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

Multirow Subquery Operator Example

Page 404: Database Systems

1

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

FROM Subquery Example

Page 405: Database Systems

1

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

Inline Subquery Example

Page 406: Database Systems

1

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

Correlated Subquery Examples

Page 407: Database Systems

1

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

EXISTS Correlated Subquery Examples

Page 408: Database Systems

1

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

Selected MS Access/SQL Server

Date/Time Functions

Page 409: Database Systems

1

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

Selected Oracle Date/Time Functions

Page 410: Database Systems

1

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

Selected Oracle Date/Time Functions

(continued)

Page 411: Database Systems

1

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

Selected Oracle Numeric Functions

Page 412: Database Systems

1

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

Selected Oracle String Functions

Page 413: Database Systems

1

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

Selected Oracle Conversion Functions

Page 414: Database Systems

1

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

Selected Oracle Conversion Functions

(continued)

Page 415: Database Systems

1

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

Oracle Sequence

Page 416: Database Systems

1

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

Oracle Sequence Examples

Page 417: Database Systems

1

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

The PRODMASTER

and PRODSALES Tables

Page 418: Database Systems

1

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

The Oracle UPDATE Error Message

Page 419: Database Systems

1

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

Creating an Updatable View in Oracle

Page 420: Database Systems

1

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

PRODMASTER Table Update,

Using an Updatable View

Page 421: Database Systems

1

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

Anonymous PL/SQL Block Examples

Page 422: Database Systems

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

Page 423: Database Systems

1

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

Anonymous PL/SQL Block

with Variables and Loops

Page 424: Database Systems

1

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

PL/SQL Basic Data Types

Page 425: Database Systems

1

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

The PRODUCT Table

Page 426: Database Systems

1

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

Creating the

TRG_PRODUCT_REORDER Trigger

Page 427: Database Systems

1

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

Verifying the TRG_PRODUCT_REORDER

Trigger Execution

Page 428: Database Systems

1

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

The P_REORDER Value Mismatch After

Update of the P_MIN Attribute

Page 429: Database Systems

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

Page 430: Database Systems

1

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

Creating the PRC_PROD_DISCOUNT

Stored Procedure

Page 431: Database Systems

1

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

Results of the PRC_PROD_DISCOUNT

Stored Procedure

Page 432: Database Systems

1

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

The PRC_CUS_ADD Stored Procedure

Page 433: Database Systems

1

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

The PRC_INV_ADD and

PRC_LINE_ADD Stored Procedures

Page 434: Database Systems

1

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

Testing the PRC_INV_ADD and

PRC_LINE_ADD Procedures

Page 435: Database Systems

1

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

Cursor Processing Commands

Page 436: Database Systems

1

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

Cursor Attributes

Page 437: Database Systems

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

Page 438: Database Systems

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

Page 439: Database Systems

1

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

SQL Status and Error Reporting Variables

Page 440: Database Systems

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

Page 441: Database Systems

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

Page 442: Database Systems

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

Page 443: Database Systems

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

Page 444: Database Systems

1

444

Chapter 8

Database Design

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

Page 445: Database Systems

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)

Page 446: Database Systems

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

Page 447: Database Systems

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

Page 448: Database Systems

1

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

A Simple Cross-Classification Table:

Transforming Data into Information

Page 449: Database Systems

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

Page 450: Database Systems

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

Page 451: Database Systems

1

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

Generating Information

for Decision Making

Page 452: Database Systems

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

Page 453: Database Systems

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

Page 454: Database Systems

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

Page 455: Database Systems

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

Page 456: Database Systems

1

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

The Systems Development Life Cycle

(SDLC)

Page 457: Database Systems

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

Page 458: Database Systems

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

Page 459: Database Systems

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

Page 460: Database Systems

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

Page 461: Database Systems

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

Page 462: Database Systems

1

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

The Database Life Cycle (DBLC)

Page 463: Database Systems

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

Page 464: Database Systems

1

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

Summary of Activities in the Database

Initial Study

Page 465: Database Systems

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

Page 466: Database Systems

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

Page 467: Database Systems

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?

Page 468: Database Systems

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

Page 469: Database Systems

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

Page 470: Database Systems

1

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

Two Views of Data:

Business Manager and Designer

Page 471: Database Systems

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

Page 472: Database Systems

1

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

Procedure Flow in the Database Design

Page 473: Database Systems

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

Page 474: Database Systems

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

Page 475: Database Systems

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

Page 476: Database Systems

1

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

Developing the Conceptual Model

Using ER Diagrams

Page 477: Database Systems

1

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

A Composite Entity

Page 478: Database Systems

1

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

Data Redundancies in the VIDEO Table

Page 479: Database Systems

1

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

ER Modeling Is an Iterative Process

Based on Many Activities

Page 480: Database Systems

1

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

Conceptual Design Tools

and Information Sources

Page 481: Database Systems

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

Page 482: Database Systems

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

Page 483: Database Systems

1

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

The ER Model Verification Process

Page 484: Database Systems

1

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

Iterative ER Model Verification Process

Page 485: Database Systems

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

Page 486: Database Systems

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

Page 487: Database Systems

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

Page 488: Database Systems

1

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

A Simple Conceptual Model

Page 489: Database Systems

1

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

Sample Layout for the COURSE Table

Page 490: Database Systems

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

Page 491: Database Systems

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

Page 492: Database Systems

1

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

Physical Organization of a DB2 Database

Environment

Page 493: Database Systems

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

Page 494: Database Systems

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

Page 495: Database Systems

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

Page 496: Database Systems

1

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

Integrity

• Enforced through proper use of primary and

foreign key rules

Page 497: Database Systems

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

Page 498: Database Systems

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

Page 499: Database Systems

1

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

The Need for Concurrency Control

Page 500: Database Systems

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

Page 501: Database Systems

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

Page 502: Database Systems

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

Page 503: Database Systems

1

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

Parallel Activities in the

DBLC and the SDLC

Page 504: Database Systems

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

Page 505: Database Systems

1

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

Top-Down vs. Bottom-Up Design

Sequencing

Page 506: Database Systems

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

Page 507: Database Systems

1

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

Centralized Design

Page 508: Database Systems

1

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

Decentralized Design

Page 509: Database Systems

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

Page 510: Database Systems

1

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

Summary of Aggregation Problems

Page 511: Database Systems

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

Page 512: Database Systems

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

Page 513: Database Systems

1

513

Chapter 9

Transaction Management and

Concurrency Control

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

Page 514: Database Systems

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

Page 515: Database Systems

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

Page 516: Database Systems

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

Page 517: Database Systems

1

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

The Relational Schema for the

Ch09_SaleCo Database

Page 518: Database Systems

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

Page 519: Database Systems

1

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

Tracing the Transaction in the

Ch09_SaleCo Database

Figure 9.2

Page 520: Database Systems

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

Page 521: Database Systems

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

Page 522: Database Systems

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

Page 523: Database Systems

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

Page 524: Database Systems

1

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

A Transaction Log

Page 525: Database Systems

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

Page 526: Database Systems

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

Page 527: Database Systems

1

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

Normal Execution of Two Transactions

Page 528: Database Systems

1

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

Lost Updates

Page 529: Database Systems

1

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

Correct Execution of Two Transactions

Page 530: Database Systems

1

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

An Uncommitted Data Problem

Page 531: Database Systems

1

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

Retrieval During Update

Page 532: Database Systems

1

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

Transaction Results:

Data Entry Correction

Page 533: Database Systems

1

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

Inconsistent Retrievals

Page 534: Database Systems

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

Page 535: Database Systems

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

Page 536: Database Systems

1

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

Read/Write Conflict Scenarios:

Conflicting Database Operations Matrix

Page 537: Database Systems

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

Page 538: Database Systems

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)

Page 539: Database Systems

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

Page 540: Database Systems

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

Page 541: Database Systems

1

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

A Database-Level Locking Sequence

Page 542: Database Systems

1

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

An Example of a Table-Level Lock

Page 543: Database Systems

1

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

Example of a Page-Level Lock

Page 544: Database Systems

1

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

An Example of a Row-Level Lock

Page 545: Database Systems

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

Page 546: Database Systems

1

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

An Example of a Binary Lock

Page 547: Database Systems

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

Page 548: Database Systems

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

Page 549: Database Systems

1

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

Two-Phase Locking Protocol

Page 550: Database Systems

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

Page 551: Database Systems

1

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

How a Deadlock Condition Is Created

Page 552: Database Systems

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

Page 553: Database Systems

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

Page 554: Database Systems

1

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

Wait/Die and Wound/Wait

Concurrency Control Schemes

Page 555: Database Systems

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

Page 556: Database Systems

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)

Page 557: Database Systems

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

Page 558: Database Systems

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

Page 559: Database Systems

1

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

A Transaction Log for Transaction

Recovery Examples

Page 560: Database Systems

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

Page 561: Database Systems

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

Page 562: Database Systems

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

Page 563: Database Systems

1

563

Chapter 10

Distributed Database

Management Systems

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

Page 564: Database Systems

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

Page 565: Database Systems

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

Page 566: Database Systems

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

Page 567: Database Systems

1

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

Centralized Database Management

System

Page 568: Database Systems

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

Page 569: Database Systems

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

Page 570: Database Systems

1

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

Distributed Processing Environment

Page 571: Database Systems

1

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

Distributed Database Environment

Page 572: Database Systems

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

Page 573: Database Systems

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

Page 574: Database Systems

1

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

A Fully Distributed Database

Management System

Page 575: Database Systems

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

Page 576: Database Systems

1

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

Distributed Database System

Components

Page 577: Database Systems

1

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

Database Systems: Levels of Data and

Process Distribution

Page 578: Database Systems

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

Page 579: Database Systems

1

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

Single-Site Processing, Single-Site Data

(Centralized)

Page 580: Database Systems

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

Page 581: Database Systems

1

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

Multiple-Site Processing, Single-Site Data

Page 582: Database Systems

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

Page 583: Database Systems

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

Page 584: Database Systems

1

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

Heterogeneous Distributed

Database Scenario

Page 585: Database Systems

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

Page 586: Database Systems

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

Page 587: Database Systems

1

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

A Summary of Transparency Features

Page 588: Database Systems

1

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

Fragment Locations

Page 589: Database Systems

1

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

Transaction Transparency

• Ensures database transactions will maintain

distributed database’s integrity and

consistency

Page 590: Database Systems

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

Page 591: Database Systems

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

Page 592: Database Systems

1

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

A Remote Request

Page 593: Database Systems

1

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

A Remote Transaction

Page 594: Database Systems

1

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

A Distributed Transaction

Page 595: Database Systems

1

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

A Distributed Request

Page 596: Database Systems

1

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

Another Distributed Request

Page 597: Database Systems

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

Page 598: Database Systems

1

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

The Effect of a Premature COMMIT

Page 599: Database Systems

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

Page 600: Database Systems

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

Page 601: Database Systems

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

Page 602: Database Systems

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

Page 603: Database Systems

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

Page 604: Database Systems

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

Page 605: Database Systems

1

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

A Sample CUSTOMER Table

Page 606: Database Systems

1

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

Horizontal Fragmentation of the

CUSTOMER Table by State

Page 607: Database Systems

1

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

Table Fragments in Three Locations

Page 608: Database Systems

1

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

Vertically Fragmented Table Contents

Page 609: Database Systems

1

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

Mixed Fragmentation of the

CUSTOMER Table

Page 610: Database Systems

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

Page 611: Database Systems

1

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

Table Contents After the Mixed

Fragmentation Process

Page 612: Database Systems

1

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

Data Replication

Page 613: Database Systems

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

Page 614: Database Systems

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

Page 615: Database Systems

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

Page 616: Database Systems

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

Page 617: Database Systems

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

Page 618: Database Systems

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

Page 619: Database Systems

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

Page 620: Database Systems

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

Page 621: Database Systems

1

621

Chapter 11

Object Oriented Databases

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

Page 622: Database Systems

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

Page 623: Database Systems

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

Page 624: Database Systems

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

Page 625: Database Systems

1

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

Object Orientation Contributions

Page 626: Database Systems

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

Page 627: Database Systems

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

Page 628: Database Systems

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

Page 629: Database Systems

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

Page 630: Database Systems

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

Page 631: Database Systems

1

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

Real-World Student Objects

Page 632: Database Systems

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

Page 633: Database Systems

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

Page 634: Database Systems

1

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

Object Attributes

Page 635: Database Systems

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

Page 636: Database Systems

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

Page 637: Database Systems

1

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

Depiction of an Object

Page 638: Database Systems

1

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

Method Components

Page 639: Database Systems

1

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

Objects Send Messages to Each Other

Page 640: Database Systems

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

Page 641: Database Systems

1

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

Class Illustration

Page 642: Database Systems

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

Page 643: Database Systems

1

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

Public and Private Aspects of an Object

Page 644: Database Systems

1

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

OO Summary: Object Characteristics

Page 645: Database Systems

1

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

Musical Instruments Class Hierarchy

Page 646: Database Systems

1

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

Single Inheritance

Page 647: Database Systems

1

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

Multiple Inheritance

Page 648: Database Systems

1

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

Motor Vehicle and Bicycle Instance

Variables

Page 649: Database Systems

1

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

Employee Class Hierarchy Method

Override

Page 650: Database Systems

1

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

Employee Class Hierarchy Polymorphism

Page 651: Database Systems

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

Page 652: Database Systems

1

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

Object Classification

• Simple object

• Composite object

• Compound object

• Hybrid object

• Associative object

Page 653: Database Systems

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

Page 654: Database Systems

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)

Page 655: Database Systems

1

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

Comparing the OO and ER Model

Components

Page 656: Database Systems

1

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

Shared Representation for All Objects of

the Class Person

Page 657: Database Systems

1

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

State of a Person Object Instance

Page 658: Database Systems

1

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

Defining Three Abstract Data Types

Page 659: Database Systems

1

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

Object Representation for Instances of

the Class Person with ADTs

Page 660: Database Systems

1

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

Object State for an Instance of the Class

Person, Using ADTs

Page 661: Database Systems

1

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

Referential Object Sharing

Page 662: Database Systems

1

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

Class Hierarchy

Page 663: Database Systems

1

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

Employee Object Representation

Page 664: Database Systems

1

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

Class Hierarchy for the EDLP Retail

Corporation

Page 665: Database Systems

1

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

Representing a 1:M Relationship

Page 666: Database Systems

1

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

Representing 1:1 and 1:M Relationships

Page 667: Database Systems

1

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

Employee-Dependent Relationship

Page 668: Database Systems

1

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

Representing the M:N Relationship

Page 669: Database Systems

1

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

Representing the M:N Relationship with

Associated Attributes

Page 670: Database Systems

1

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

Representing the M:N Relationship with

Intersection Class

Page 671: Database Systems

1

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

Object Space Representation

Page 672: Database Systems

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

Page 673: Database Systems

1

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

INVENTORY Table with Predetermined

(Base) Data Types

Page 674: Database Systems

1

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

Inventory Class with Early Binding

Page 675: Database Systems

1

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

OODM Inventory Class with Late Binding

Page 676: Database Systems

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

Page 677: Database Systems

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

Page 678: Database Systems

1

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

An Invoice Representation

Page 679: Database Systems

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

Page 680: Database 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,

Page 681: Database Systems

1

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

Object Oriented Database Management

Systems

Page 682: Database Systems

1

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

The Thirteen OODBMS Rules

Page 683: Database Systems

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

Page 684: Database Systems

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

Page 685: Database Systems

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

Page 686: Database Systems

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)

Page 687: Database Systems

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

Page 688: Database Systems

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

Page 689: Database Systems

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

Page 690: Database Systems

1

690

Chapter 12

The Data Warehouse

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

Page 691: Database Systems

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

Page 692: Database Systems

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

Page 693: Database Systems

1

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

Solving Business Problems and Adding

Value with Data Warehouse-Based Solutions

Page 694: Database Systems

1

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

Solving Business Problems and Adding Value

with Data Warehouse-Based Solutions (continued)

Page 695: Database Systems

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

Page 696: Database Systems

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

Page 697: Database Systems

1

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

Main Components of a

Decision Support System (DSS)

Page 698: Database Systems

1

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

Transforming Operational Data Into

Decision Support Data

Page 699: Database Systems

1

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

Contrasting Operational and DSS Data

Characteristics

Page 700: Database Systems

1

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

Ten-Year Sales History for a Single

Department, in Millions of Dollars

Page 701: Database Systems

1

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

Yearly Sales Summaries, Two Stores and Two

Departments per Store,

in Millions of Dollars

Page 702: Database Systems

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

Page 703: Database Systems

1

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

A Comparison of Data Warehouse and

Operational Database Characteristics

Page 704: Database Systems

1

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

Creating a Data Warehouse

Page 705: Database Systems

1

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

DSS Architectural Styles

Page 706: Database Systems

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

Page 707: Database Systems

1

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

Operational vs. Multidimensional

View of Sales

Page 708: Database Systems

1

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

Integration of OLAP

with a Spreadsheet Program

Page 709: Database Systems

1

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

OLAP Client/Server Architecture

Page 710: Database Systems

1

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

OLAP Server Arrangement

Page 711: Database Systems

1

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

OLAP Server with Multidimensional Data

Store Arrangement

Page 712: Database Systems

1

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

OLAP Server With Local Mini Data Marts

Page 713: Database Systems

1

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

Bitmap Representation of REGION

Values

Page 714: Database Systems

1

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

Typical ROLAP Client/Server Architecture

Page 715: Database Systems

1

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

MOLAP Client/Server Architecture

Page 716: Database Systems

1

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

Relational vs. Multidimensional OLAP

Page 717: Database Systems

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

Page 718: Database Systems

1

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

Simple Star Schema

Page 719: Database Systems

1

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

Possible Attributes for Sales Dimensions

Page 720: Database Systems

1

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

Three-Dimensional View of Sales

Page 721: Database Systems

1

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

Slice and Dice View of Sales

Page 722: Database Systems

1

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

Location Attribute Hierarchy

Page 723: Database Systems

1

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

Attribute Hierarchies In Multidimensional

Analysis

Page 724: Database Systems

1

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

Star Schema for Sales

Page 725: Database Systems

1

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

Orders Star Schema

Page 726: Database Systems

1

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

Normalized Dimension tables

Page 727: Database Systems

1

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

Multiple Fact Tables

Page 728: Database Systems

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

Page 729: Database Systems

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

Page 730: Database Systems

1

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

Data Warehouse

Implementation Road Map

Page 731: Database Systems

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

Page 732: Database Systems

1

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

Extraction of Knowledge From Data

Page 733: Database Systems

1

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

Data-Mining Phases

Page 734: Database Systems

1

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

A Sample of Current Data Warehousing

and Data-Mining Vendors

Page 735: Database Systems

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

Page 736: Database Systems

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

Page 737: Database Systems

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

Page 738: Database Systems

1

738

Chapter 13

Databases in Electronic Commerce

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

Page 739: Database Systems

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

Page 740: Database Systems

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

Page 741: Database Systems

1

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

Orbitz E-Commerce Web Site

Page 742: Database Systems

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

Page 743: Database Systems

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

Page 744: Database Systems

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

Page 745: Database Systems

1

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

Amazon.com Home Page

Page 746: Database Systems

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

Page 747: Database 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

Page 748: Database Systems

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

Page 749: Database Systems

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

Page 750: Database Systems

1

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

E-Commerce Styles

Page 751: Database Systems

1

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

E-Commerce Automation of Supply Chain

Page 752: Database Systems

1

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

Covisint.com: Automotive B2B

Marketplace

Page 753: Database Systems

1

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

Sample B2C Web Sites

Page 754: Database Systems

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

Page 755: Database Systems

1

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

E-Commerce Architecture

Page 756: Database Systems

1

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

Internet Building Blocks and Basic

Services

Page 757: Database Systems

1

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

Internet Building Blocks and Basic

Services (continued)

Page 758: Database Systems

1

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

Basic Internet Services

Page 759: Database Systems

1

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

Business-Enabling Services

Page 760: Database Systems

1

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

Business-Enabling Services (continued)

Page 761: Database Systems

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

Page 762: Database Systems

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)

Page 763: Database Systems

1

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

A Sample E-Commerce Transaction

Page 764: Database Systems

1

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

Registering with a Certification Authority

Page 765: Database Systems

1

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

Web Browser Security Settings

Page 766: Database Systems

1

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

Web Browser Secure Session

Page 767: Database Systems

1

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

Web Browser Proxy Settings

Page 768: Database Systems

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

Page 769: Database Systems

1

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

Setting Up a Microsoft Electronic Wallet

Page 770: Database Systems

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

Page 771: Database Systems

1

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

Main Tables for E-Commerce Database

Page 772: Database Systems

1

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

CUSTOMER Table

Page 773: Database Systems

1

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

CUSTOMER Table (Continued)

Page 774: Database Systems

1

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

PRODUCT Table

Page 775: Database Systems

1

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

PRODUCT Table (Continued)

Page 776: Database Systems

1

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

PRODTYPE Table

Page 777: Database Systems

1

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

ORDER Table

Page 778: Database Systems

1

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

ORDER Table (Continued)

Page 779: Database Systems

1

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

ORDLINE Table

Page 780: Database Systems

1

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

SHOPCART Table

Page 781: Database Systems

1

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

PMTTYPE Table

Page 782: Database Systems

1

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

SHIPTYPE Table

Page 783: Database Systems

1

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

TAXRATE Table

Page 784: Database Systems

1

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

STATE Table

Page 785: Database Systems

1

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

PROMOTION Table

Page 786: Database Systems

1

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

PRICEWATCH Table

Page 787: Database Systems

1

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

PRODPRICE Table

Page 788: Database Systems

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

Page 789: Database Systems

1

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

Contents of the ProductList.xml

Document

Page 790: Database Systems

1

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

Contents of the ProductList.dtd Document

Page 791: Database Systems

1

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

Contents of the ProductListv2.xml

Document

Page 792: Database Systems

1

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

DTD and XML Documents for Order Data

Page 793: Database Systems

1

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

The XML Schema Document for the

Order Data

Page 794: Database Systems

1

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

Framework for XML Transformations

Page 795: Database Systems

1

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

Displaying XML Documents in MSIE 5.0

Page 796: Database Systems

1

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

XML Data Binding in MSIE 5.0

Page 797: Database Systems

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

Page 798: Database Systems

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

Page 799: Database Systems

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

Page 800: Database Systems

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

Page 801: Database Systems

1

801

Chapter 14

Web Database Development

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

Page 802: Database Systems

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

Page 803: Database Systems

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

Page 804: Database Systems

1

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

Characteristics and Benefits

of Internet Technologies

Page 805: Database Systems

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

Page 806: Database Systems

1

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

A Sample of Applications That Use Web-

Database Technology

Page 807: Database Systems

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

Page 808: Database Systems

1

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

Web-to-Database Middleware

(ColdFusion)

Page 809: Database Systems

1

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

Web Server Interfaces

Page 810: Database Systems

1

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

Windows Applications Use ODBC to

Access Databases

Page 811: Database Systems

1

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

Web-to-Database Middleware Uses

ODBC to Access Databases

Page 812: Database Systems

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

Page 813: Database Systems

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

Page 814: Database Systems

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

Page 815: Database Systems

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

Page 816: Database Systems

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

Page 817: Database Systems

1

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

How ColdFusion Works

Page 818: Database Systems

1

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

The Ch14_RobCor Database’s Relational

Schema

Page 819: Database Systems

1

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

A Simple Query Using CFQUERY and

CFOUTPUT

Page 820: Database Systems

1

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

The rc-1.cfm Script Output

(Vertical Listing)

Page 821: Database Systems

1

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

CFQUERY with Tabular CFOUTPUT

Page 822: Database Systems

1

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

The rc-2.cfm Script Output

(Horizontal Listing)

Page 823: Database Systems

1

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

CFQUERY with CFTABLE

Page 824: Database Systems

1

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

The rc-3.cfm Script Output

(Formatted Horizontal Listing)

Page 825: Database Systems

1

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

Dynamic Search Query:

Criteria Entry Form

Page 826: Database Systems

1

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

The rc-4a.cfm Script Output

(State Search Criteria Entry Form)

Page 827: Database Systems

1

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

The VENDOR Search Results

Page 828: Database Systems

1

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

The rc-4b.cfm Script Output

(Vendor Search Results: All States)

Page 829: Database Systems

1

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

The Vendor List for the Condition

VEN_STATE = ―GA‖

Page 830: Database Systems

1

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

Insert Query: Data Entry Script

Page 831: Database Systems

1

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

The rc-5a.cfm Script Output

(Department Data Entry Screen)

Page 832: Database Systems

1

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

The Insert Query Form:

Server-Side Validation Error Message

Page 833: Database Systems

1

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

Insert Query: Confirmation Script

Page 834: Database Systems

1

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

The rc-5b.cfm Script Output

(Department Data Entry Confirmation)

Page 835: Database Systems

1

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

The Insert Query:

ODBC Integrity Violation Error

Page 836: Database Systems

1

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

Update Query: Record Selection Script

Page 837: Database Systems

1

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

The rc-6a.cfm Script Output

(Record Selection Screen)

Page 838: Database Systems

1

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

Update Query: Edit Record Script

Page 839: Database Systems

1

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

The rc-6b.cfm Script Output

(Edit Record Screen)

Page 840: Database Systems

1

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

Update Query: Result Confirmation Script

Page 841: Database Systems

1

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

The rc-6c.cfm Script Output

(Update Query Result Confirmation)

Page 842: Database Systems

1

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

Delete Query: Record Selection Script

Page 843: Database Systems

1

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

The rc-7a.cfm Script Output

(Record Selection Screen)

Page 844: Database Systems

1

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

Delete Query: Show Record Script

Page 845: Database Systems

1

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

The rc-7b.cfm Script Output

(Show Record Screen)

Page 846: Database Systems

1

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

Delete Query: Result Confirmation Script

Page 847: Database Systems

1

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

The rc-7c.cfm Script Output

(Delete Query Confirmation Screen)

Page 848: Database Systems

1

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

The Delete Record Validation

Page 849: Database Systems

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

Page 850: Database Systems

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

Page 851: Database Systems

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

Page 852: Database Systems

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

Page 853: Database Systems

1

853

Chapter 15

Database Administration

Database Systems:

Design, Implementation, and Management,

Sixth Edition, Rob and Coronel

Page 854: Database Systems

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

Page 855: Database Systems

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

Page 856: Database Systems

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

Page 857: Database Systems

1

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

Fig 15.1 The Data-Information-Decision-

Making Cycle

Page 858: Database Systems

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

Page 859: Database Systems

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

Page 860: Database Systems

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

Page 861: Database Systems

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

Page 862: Database Systems

1

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

The IS Department Internal Organization

Page 863: Database Systems

1

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

The Placement of the DBA Function

Page 864: Database Systems

1

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

A DBA Functional Organization

Page 865: Database Systems

1

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

Multiple Database Administrators

in an Organization

Page 866: Database Systems

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

Page 867: Database Systems

1

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

Contrasting DA and DBA Activities

and Characteristics

Page 868: Database Systems

1

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

A Summary of DBA Activities

Page 869: Database Systems

1

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

Desired DBA Skills

Page 870: Database Systems

1

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

DBA Activities and Services

Page 871: Database Systems

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

Page 872: Database Systems

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

Page 873: Database Systems

1

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

An Example of a CASE Tool:

Visio Professional

Page 874: Database Systems

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

Page 875: Database Systems

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

Page 876: Database Systems

1

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

Forces Affecting the Development

of the ISA

Page 877: Database Systems

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

Page 878: Database Systems

1

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

The Oracle Enterprise Manager Interface

Page 879: Database Systems

1

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

Oracle Edit Local Preferred

Credentials Window

Page 880: Database Systems

1

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

Oracle RDBMS Services

Page 881: Database Systems

1

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

The Oracle Storage Manager

Page 882: Database Systems

1

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

Creating a New Tablespace

Page 883: Database Systems

1

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

The Oracle Schema Manager

Page 884: Database Systems

1

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

The Oracle Security Manager

Page 885: Database Systems

1

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

The Create User Dialog Box

Page 886: Database Systems

1

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

The Oracle Instance Manager

Page 887: Database Systems

1

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

Creating a New Database with the

Database Configuration Assistant

Page 888: Database Systems

1

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

Selecting the New Database Template

Page 889: Database Systems

1

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

Naming the Database

Page 890: Database Systems

1

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

Selecting the Database Operation Mode

Page 891: Database Systems

1

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

Specifying Initialization Parameters

Page 892: Database Systems

1

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

Specifying Storage Parameters

Page 893: Database Systems

1

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

Database Creation Options

Page 894: Database Systems

1

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

Summary of Database Creation Options

Page 895: Database Systems

1

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

Database Creation Progress

Page 896: Database Systems

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

Page 897: Database 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