Database Systems: Design, Implementation, and Management

advertisement
1
Chapter 1
File Systems and Databases
Database Systems: Design, Implementation, and
Management, Fifth Edition, Rob and Coronel
1
In this chapter, you will learn:
• What a database is, what it does, and why
database design is important
• How modern databases evolved from files and file
systems
• About flaws in file system data management
• What a DBMS is, what it does, and how it fits into
the database system
• About types of database systems and database
models
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
2
1
Introducing the Database
• Data versus Information
–
–
–
–
Data constitute building blocks of information
Information produced by processing data
Information reveals meaning of data
Good, timely, relevant information key to decision
making
– Good decision making key to organizational
survival
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
3
1
Database Management
• Database is shared, integrated computer
structure housing:
– End user data
– Metadata
• Database Management System (DBMS)
– Manages Database structure
– Controls access to data
– Contains query language
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
4
1
Importance of DBMS
• Makes data management more efficient and
effective
• Query language allows quick answers to ad
hoc queries
• Provides better access to more and bettermanaged data
• Promotes integrated view of organization’s
operations
• Reduces the probability of inconsistent data
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
5
1
DBMS Manages Interaction
Figure 1.2
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
6
1
Database Design
• Importance of Good Design
– Poor design results in unwanted data redundancy
– Poor design generates errors leading to bad
decisions
• Practical Approach
– Focus on principles and concepts of database
design
– Importance of logical design
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
7
1
Historical Roots of Database
• First applications focused on clerical tasks
• Requests for information quickly followed
• File systems developed to address needs
– Data organized according to expected use
– Data Processing (DP) specialists computerized
manual file systems
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
8
1
File Terminology
• Data
– Raw Facts
• Field
– Group of characters with specific meaning
• Record
– Logically connected fields that describe a person,
place, or thing
• File
– Collection of related records
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
9
1
Simple File System
Figure 1.5
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
10
1
File System Critique
• File System Data Management
– Requires extensive programming in thirdgeneration language (3GL)
– Time consuming
– Makes ad hoc queries impossible
– Leads to islands of information
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
11
1
File System Critique (con’t.)
•
Data Dependence
– Change in file’s data characteristics requires
modification of data access programs
– Must tell program what to do and how
– Makes file systems cumbersome from
programming and data management views
•
Structural Dependence
– Change in file structure requires modification of
related programs
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
12
1
File System Critique (con’t.)
•
Field Definitions and Naming Conventions
– Flexible record definition anticipates reporting
requirements
– Selection of proper field names important
– Attention to length of field names
– Use of unique record identifiers
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
13
1
File System Critique (con’t.)
•
Data Redundancy
–
–
Different and conflicting versions of same data
Results of uncontrolled data redundancy
• Data anomalies
– Modification
– Insertion
– Deletion
• Data inconsistency
– Lack of data integrity
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
14
1
Database Systems
• Database consists of logically related data stored
in a single repository
• Provides advantages over file system
management approach
– Eliminates inconsistency, data anomalies, data
dependency, and structural dependency problems
– Stores data structures, relationships, and access
paths
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
15
1
Database vs. File Systems
Figure 1.6
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
16
1
Database System Environment
Figure 1.7
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
17
1
Database System Types
• Single-user vs. Multiuser Database
– Desktop
– Workgroup
– Enterprise
• Centralized vs. Distributed
• Use
– Production or transactional
– Decision support or data warehouse
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
18
1
DBMS Functions
•
•
•
•
•
•
•
•
Data dictionary management
Data storage management
Data transformation and presentation
Security management
Multiuser access control
Backup and recovery management
Data integrity management
Database language and application
programming interfaces
• Database communication interfaces
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
19
1
Database Models
• Collection of logical constructs used to represent
data structure and relationships within the
database
– Conceptual models: logical nature of data
representation
– Implementation models: emphasis on how the data
are represented in the database
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
20
1
Database Models (con’t.)
• Relationships in Conceptual Models
– One-to-one (1:1)
– One-to-many (1:M)
– Many-to-many (M:N)
• Implementation Database Models
– Hierarchical
– Network
– Relational
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
21
1
Hierarchical Database Model
• Logically represented by an upside down tree
– Each parent can have many children
– Each child has only one parent
Figure 1.8
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
22
1
Hierarchical Database Model
• Advantages
–
–
–
–
Conceptual simplicity
Database security and integrity
Data independence
Efficiency
• Disadvantages
–
–
–
–
–
Complex implementation
Difficult to manage and lack of standards
Lacks structural independence
Applications programming and use complexity
Implementation limitations
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
23
1
Network Database Model
• Each record can have multiple parents
– Composed of sets
– Each set has owner record and member record
– Member may have several owners
Figure
1.10
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
24
1
Network Database Model
• Advantages
–
–
–
–
–
–
Conceptual simplicity
Handles more relationship types
Data access flexibility
Promotes database integrity
Data independence
Conformance to standards
• Disadvantages
– System complexity
– Lack of structural independence
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
25
1
Relational Database Model
• Perceived by user as a collection of tables for
data storage
• Tables are a series of row/column intersections
• Tables related by sharing common entity
characteristic(s)
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
26
1
Relational Database Model (con’t.)
Figure 1.11
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
27
1
Relational Database Model
• Advantages
– Structural independence
– Improved conceptual simplicity
– Easier database design, implementation,
management, and use
– Ad hoc query capability with SQL
– Powerful database management system
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
28
1
Relational Database Model
• Disadvantages
– Substantial hardware and system software
overhead
– Poor design and implementation is made easy
– May promote “islands of information” problems
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
29
1
Entity Relationship Database Model
• Complements the relational data model concepts
• Represented in an entity relationship diagram
(ERD)
• Based on entities, attributes, and relationships
Figure 1.13
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
30
1
Entity Relationship Database Model
• Advantages
–
–
–
–
Exceptional conceptual simplicity
Visual representation
Effective communication tool
Integrated with the relational database model
• Disadvantages
–
–
–
–
Limited constraint representation
Limited relationship representation
No data manipulation language
Loss of information content
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
31
1
Object-Oriented Database Model
• Objects or abstractions of real-world entities are
stored
– Attributes describe properties
– Collection of similar objects is a class
• Methods represent real world actions of classes
• Classes are organized in a class hierarchy
– Inheritance is ability of object to inherit attributes
and methods of classes above it
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
32
1
OO Data Model
• Advantages
–
–
–
–
Adds semantic content
Visual presentation includes semantic content
Database integrity
Both structural and data independence
• Disadvantages
–
–
–
–
Lack of OODM
Complex navigational data access
Steep learning curve
High system overhead slows transactions
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
33
1
Database Models and the Internet
• Characteristics of “Internet age” databases
–
–
–
–
Flexible, efficient, and secure Internet access
Easily used, developed, and supported
Supports complex data types and relationships
Seamless interfaces with multiple data sources
and structures
– Simplicity of conceptual database model
– Many database design, implementation, and
application development tools
– Powerful DBMS GUI make DBA job easier
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
34
1
Chapter 2
The Relational Database Model
Database Systems: Design, Implementation, and
Management, Fifth Edition, Rob and Coronel
1
In this chapter, you will learn:
• That the relational database model takes a
logical view of data
• That the relational database model’s basic
components are entities and their attributes, and
relationships among entities
• How entities and their attributes are organized
into tables
• 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
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
36
1
Logical View of Data
• Relational Database
– Designer focuses on logical representation rather
than physical
– Use of table advantageous
• Structural and data independence
• Related records stored in independent tables
• Logical simplicity
– Allows for more effective design strategies
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
37
1
Logical View of Data (con’t.)
• Entities and Attributes
– Entity is a person, place, event, or thing about
which data is collected
– Attributes are characteristics of the entity
• Tables
– Holds related entities or entity set
– Also called relations
– Comprised of rows and columns
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
38
1
Table Characteristics
• Two-dimensional structure with rows and
columns
• Rows (tuples) represent single entity
• Columns represent attributes
• Row/column intersection represents single
value
• Tables must have an attribute to uniquely
identify each row
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
39
1
Table Characteristics (con’t.)
• Column values all have same data format
• Each column has range of values called
attribute domain
• Order of the rows and columns is immaterial to
the DBMS
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
40
1
Keys
• One or more attributes that
determine other attributes
– Key attribute
– Composite key
• Full functional dependence
• Entity integrity
– Uniqueness
– No ‘null’ value in key
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
41
1
Example Tables
Figure 2.1
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
42
1
Simple Relational Database
Figure 2.2
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
43
1
Keys (con’t.)
• Superkey
– Uniquely identifies each entity
• Candidate key
– Minimal superkey
• Primary key
– Candidate key to uniquely identify all other
attributes in a given row
• Secondary key
– Used only for data retrieval
• Foreign key
– Values must match primary key in another table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
44
1
Integrity Rules
• Entity integrity
– Ensures all entities are unique
– Each entity has unique key
• Referential integrity
– Foreign key must have null value or match
primary key values
– Makes it impossible to delete row whose primary
key has mandatory matching foreign key values in
another table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
45
1
Relational Database Operators
• Relational algebra determines
table manipulations
• Key operators
– SELECT
– PROJECT
– JOIN
• Other operators
–
–
–
–
–
INTERSECT
UNION
DIFFERENCE
PRODUCT
DIVIDE
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
46
1
Union
Combines all rows
Figure 2.5
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
47
1
Intersect
Yields rows that appear in both tables
Figure 2.6
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
48
1
Difference
Yields rows not found in other tables
Figure 2.7
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
49
1
Product
Yields all possible pairs from two tables
Figure 2.8
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
50
1
Select
Yields a subset of rows based on specified criterion
Figure 2.9
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
51
1
Project
Yields all values for selected attributes
Figure 2.10
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
52
1
Join
Information from two or more tables is combined
Figure 2.11
Figure 2.14
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
53
1
Natural Join Process
• Links tables by selecting rows with common
values in common attribute(s)
• Three-stage process
– Product creates one table
– Select yields appropriate rows
– Project yields single copy of each attribute to
eliminate duplicate columns
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
54
1
Other Joins
• EquiJOIN
– Links tables based on equality condition that
compares specified columns of tables
– Does not eliminate duplicate columns
– Join criteria must be explicitly defined
• Theta JOIN
– EquiJOIN that compares specified columns of
each table using operator other than equality one
• Outer JOIN
– Matched pairs are retained
– Unmatched values in other tables left null
– Right and left
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
55
1
Divide
Requires user of single-column table and two-column table
Figure 2.17
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
56
1
Data Dictionary and System Catalog
• Data dictionary
– Provides detailed account of all tables found within
database
– Metadata
– Attribute names and characteristics
• System catalog
–
–
–
–
–
Detailed data dictionary
System-created database
Stores database characteristics and contents
Tables can be queried just like any other tables
Automatically produces database documentation
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
57
1
Relationships within Relational Database
• Relationship classifications
– 1:1
– 1:M
– M:N
• E-R Model
– ERD Maps E-R model
– Chen
– Crow’s Feet
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
58
1
ERD Symbols
• Rectangles represent entities
• Diamonds represent the relationship(s)
between the entities
• “1” side of relationship
– Number 1 in Chen Model
– Bar crossing line in Crow’s Feet Model
• “Many” relationships
– Letter “M” and “N” in Chen Model
– Three pronged “Crow’s foot” in Crow’s Feet
Model
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
59
1
Example 1:M Relationship
Figure 2.18
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
60
1
Example 1:M Relationship
Figure 2.20
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
61
1
Example M:N Relationship
Figure 2.23
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
62
1
Example M:N Relationship
Figure 2.24
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
63
1
Converting M:N Relationship to Two
1:M Relationships
Figure 2.25
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
64
1
Converting M:N Relationship to Two
1:M Relationships (con’t.)
Figure 2.26
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
65
1
Converting M:N Relationship to Two
1:M Relationships (con’t.)
Figure 2.27
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
66
1
Converting M:N Relationship to Two
1:M Relationships (con’t.)
Figure 2.28
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
67
1
Data Redundancy Revisited
• Foreign keys can reduce redundancy
• Some redundancy is desirable
– Called controlled redundancy
– Speed
– Information requirements
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
68
1
Indexes
• Points to location
• Makes retrieval of data faster
Figure 2.31
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
69
1
Chapter 3
Entity Relationship (E-R)
Modeling
Database Systems: Design, Implementation, and
Management, Fifth Edition, Rob and Coronel
1
In this chapter, you will learn:
• What a conceptual model is and what its purpose is
• The difference between internal and external models
• How internal and external models serve the database
design process
• 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 E-R modeling tools
• That real-world database design often requires you to
reconcile conflicting goals
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
71
1
Basic Modeling Concepts
• Art and science
• Good judgment coupled with powerful design
tools
• Models
– “Description or analogy used to visualize
something that cannot be directly observed”
Webster’s Dictionary
• Data Model
– Relatively simple representation of complex realworld data structures
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
72
1
Data Models: Degrees of Data
Abstraction
Figure 3.1
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
73
1
Degrees of Abstraction
• Conceptual
– Global view of data
– Basis for identification and description of main
data items
– ERD used to represent conceptual data model
– Hardware and software independent
• Internal
– Representation of database as seen by DBMS
– Adapts conceptual model to specific DBMS
– Software dependent
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
74
1
Degrees of Abstraction (con’t.)
• External
–
–
–
–
–
–
Users’ views of data environment
Provides subsets of internal view
Makes application program development easier
Facilitates designers’ tasks
Ensures adequacy of conceptual model
Ensures security constraints in design
• Physical
– Lowest level of abstraction
– Software and hardware dependent
– Requires definition of physical storage devices
and access methods
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
75
1
The Entity Relationship (E-R) Model
• Represents conceptual view
• Main Components
– Entities
• Corresponds to entire table, not row
• Represented by rectangle
– Attributes
– Relationships
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
76
1
Attributes
• Characteristics of entities
• Domain is set of possible values
• Primary keys underlined
Figure 3.6
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
77
1
Attributes (con’t.)
• Simple
– Cannot be subdivided
– Age, sex, marital status
• Composite
– Can be subdivided into
additional attributes
– Address into street,
city, zip
• Single-valued
– Can have only a single
value
– Person has one social
security number
• Multi-valued
– Can have many values
– Person may have
several college degrees
• Derived
– Can be derived with
algorithm
– Age can be derived
from date of birth
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
78
1
Relationships
•
•
•
•
Association between entities
Connected entities are called participants
Operate in both directions
Connectivity describes relationship classification
– 1:1, 1:M, M:N
• Cardinality
– Expresses number of entity occurrences
associated with one occurrence of related entity
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
79
1
Connectivity and Cardinality in an ERD
Figure 3.12
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
80
1
Relationship Strength
• Existence dependence
– Entity’s existence depends on existence of related
entities
– Existence-independent entities can exist apart from
related entities
– EMPLOYEE claims DEPENDENT
• Weak (non-identifying)
– One entity is existence-independent on another
– PK of related entity doesn’t contain PK component of
parent entity
• Strong (identifying)
– One entity is existence-dependent on another
– PK of related entity contains PK component of parent
entity
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
81
1
Relationship Participation
• Optional
– Entity occurrence does not require a
corresponding occurrence in related entity
– Shown by drawing a small circle on side of
optional entity on ERD
• Mandatory
– Entity occurrence requires corresponding
occurrence in related entity
– If no optionality symbol is shown on ERD, it is
mandatory
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
82
1
Weak Entity
• Existence-dependent on another entity
• Has primary key that is partially or totally
derived from parent entity
Figure 3.19
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
83
1
Relationship Degree
• Indicates number of associated entities
• Unary
– Single entity
– Recursive
– Exists between occurrences of same entity set
• Binary
– Two entities associated
• Ternary
– Three entities associated
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
84
1
Three Types of Relationships
Figure 3.21
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
85
1
Composite Entities
• Used to ‘bridge’ between M:N relationships
• Bridge entities composed of primary keys of each
entity needing connection
Figure 3.30
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
86
1
Composite Entities (con’t.)
Figure 3.31
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
87
1
Entity Supertypes and Subtypes
• Generalization hierarchy
– Depicts relationships between higher-level
supertype and lower-level subtype entities
– Supertype has shared attributes
– Subtypes have unique attributes
– Disjoint relationships
• Unique subtypes
• Non-overlapping
• Indicated with a ‘G’
– Overlapping subtypes use ‘Gs’ Symbol
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
88
1
Generalization Hierarchy with
Overlapping Subtypes
Figure 3.35
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
89
1
Comparison of E-R Modeling Symbols
• Alternate styles developed to enable easier use
of CASE tools
• Chen
– Moved conceptual design into practical database
design arena
• Crow’s Foot
– Cannot detail all cardinalities
• Rein85
– Similar to Crow’s Foot
– Operates at higher level of abstraction
• IDEF1X
– Derivative of ICAM studies in the late 1970’s
– Uses fewer symbols
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
90
1
Comparison of E-R Modeling Symbols
Figure 3.36
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
91
1
Developing an E-R Diagram
• Iterative Process
– Step1: General narrative of organizational
operations developed
– Step2: Basic E-R Model graphically depicted and
reviewed
– Step3: Modifications made to incorporate newly
discovered E-R components
• Repeat process until designers and users agree
E-R Diagram complete
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
92
1
Supertype/Subtype Relationship in an
ERD
Figure 3.42
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
93
1
First ERD Segment Established
Figure 3.43
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
94
1
Second and Third ERD
Segments Established
Figures 3.44 & 3.45
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
95
1
Fourth and Fifth ERD
Segments Established
Figures 3.46 & 3.47
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
96
1
Sixth and Seventh ERD
Segments Established
Figures 3.48 & 3.49
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
97
1
Eighth ERD
Segment Established
Figures 3.50
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
98
1
Ninth ERD
Segment Established
Figures 3.51
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
99
1
Components of E-R Model
Table 3.2
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
100
1
Completed ERD
Figure 3.52
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
101
1
Challenge of Database Design:
Conflicting Goals
• Database must be designed to conform to design
standards
• High-speed processing may require design
compromises
• Quest for timely information may be the focus of
database design
• Other concerns
–
–
–
–
Security
Performance
Shared access
Integrity
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
102
1
Chapter 4
Normalization of Database
Tables
Database Systems: Design, Implementation, and
Management, Fifth Edition, Rob and Coronel
1
In this chapter, you will learn:
• What normalization is and what role it plays in
database design
• 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 E-R modeling are used
concurrently to produce a good database design
• That some situations require denormalization to
generate information efficiently
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
104
1
Database Tables and Normalization
• Table is basic building block in database design
• Normalization is process for assigning attributes
to entities
– Reduces data redundancies
– Helps eliminate data anomalies
– Produces controlled redundancies to link tables
• Normalization stages
–
–
–
–
1NF - First normal form
2NF - Second normal form
3NF - Third normal form
4NF - Fourth normal form
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
105
1
Need for Normalization
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
4.1
106
1
Figure 4.1 Observations
• PRO_NUM intended to be primary key
• Table entries invite data inconsistencies
• Table displays data anomalies
– Update
• Modifying JOB_CLASS
– Insertion
• New employee must be assigned project
– Deletion
• If employee deleted, other vital data lost
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
107
1
Conversion to 1NF
• Repeating groups must be eliminated
– Proper primary key developed
• Uniquely identifies attribute values (rows)
• Combination of PROJ_NUM and EMP_NUM
– Dependencies can be identified
• Desirable dependencies based on primary key
• Less desirable dependencies
– Partial
» based on part of composite primary key
– Transitive
» one nonprime attribute depends on another nonprime
attribute
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
108
1
Dependency Diagram (1NF)
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
4.4
109
1
Data Organization: 1NF
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
4.3
110
1
1NF Summarized
• All key attributes defined
• No repeating groups in table
• All attributes dependent on
primary key
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
111
1
Conversion to 2NF
•
•
•
•
•
Start with 1NF format:
Write each key component on separate line
Write original key on last line
Each component is new table
Write dependent attributes after each key
PROJECT
(PROJ_NUM, PROJ_NAME)
EMPLOYEE (EMP_NUM, EMP_NAME, JOB_CLASS, CHG_HOUR)
ASSIGN (PROJ_NUM, EMP_NUM, HOURS)
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
112
1
2NF Conversion Results
Figure
4.5
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
113
1
2NF Summarized
• In 1NF
• Includes no partial dependencies
– No attribute dependent on a portion of primary key
• Still possible to exhibit transitive dependency
– Attributes may be functionally dependent on
nonkey attributes
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
114
1
Conversion to 3NF
• Create separate table(s) to eliminate transitive
functional dependencies
PROJECT
(PROJ_NUM, PROJ_NAME)
ASSIGN (PROJ_NUM, EMP_NUM, HOURS)
EMPLOYEE (EMP_NUM, EMP_NAME, JOB_CLASS)
JOB (JOB_CLASS, CHG_HOUR)
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
115
1
3NF Summarized
• In 2NF
• Contains no transitive dependencies
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
116
1
Additional DB Enhancements
Figure
4.6
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
117
1
Boyce-Codd Normal Form (BCNF)
• Every determinant in the table is a candidate key
– Determinant is attribute whose value determines
other values in row
– 3NF table with one candidate key is already in
BCNF
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
118
1
3NF Table Not in BCNF
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
4.7
119
1
Decomposition of Table
Structure to Meet BCNF
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
4.8
120
1
Decomposition into BCNF
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
4.9
121
1
Normalization and Database Design
• Normalization should be part of the design
process
• E-R Diagram provides macro view
• Normalization provides micro view of entities
– Focuses on characteristics of specific entities
– May yield additional entities
• Difficult to separate normalization from E-R
diagramming
• Business rules must be determined
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
122
1
Initial ERD for Contracting Company
Figure
4.10
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
123
1
Modified ERD for
Contracting Company
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
Figure
4.11
124
1
Final ERD for
Contracting Company
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
4.12
125
1
Higher-Level Normal Forms
• Fourth Normal Form (4NF)
– Table is in 3NF
– Has no multiple sets of multivalued dependencies
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
126
1
Conversion to 4NF
Figure
4.15
Set of Tables in 4NF
Figure
4.14
Multivalued Dependencies
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
127
1
Denormalization
• Normalization is one of many database design
goals
• Normalized table requirements
– Additional processing
– Loss of system speed
• Normalization purity is difficult to sustain due to
conflict in:
– Design efficiency
– Information requirements
– Processing
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
128
1
Unnormalized Table Defects
• Data updates less efficient
• Indexing more cumbersome
• No simple strategies for creating views
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
129
1
Chapter 5
Structured Query Language
(SQL)
Database Systems: Design, Implementation, and
Management, Fifth Edition, Rob and Coronel
1
In this chapter, you will learn:
• The basic commands and functions of SQL
• How SQL is used for data manipulation (to add,
modify, delete, and retrieve data)
• How to use SQL to query a database to extract
useful information
• How SQL is used for data administration (to
create tables, indexes, and views)
• About more advanced SQL features such as
updatable views, stored procedures, and triggers
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
131
1
Introduction to SQL
• Ideal database language
– Create database and table structures
– Perform basic data management chores (add,
delete, and modify)
– Perform complex queries to transform data into
useful information
• SQL is the ideal DB language
– Data definition language
– Data manipulation language
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
132
1
Good Reasons to Study SQL
• ANSI standardization effort led to de facto query
standard for relational database
• Forms basis for present and future DBMS
integration efforts
• Becomes catalyst in development of distributed
databases and database client/server architecture
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
133
1
Data Definition Commands
• Create database structure
– Holds all tables and is a collection of physical files
stored on disk
– DBMS automatically creates tables to store metadata
– Database administrator creates structure or schema
• Logical group of tables or logical database
• Groups tables by owner
• Enforces security
CREATE
SCHEMA AUTHORIZATION
<creator>
Example:
CREATE SCHEMA AUTHORIZATION JONES
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
134
1
Creating Table Structure
• Tables store end-user data
• May be based on data dictionary entries
CREATE
TABLE <table name>
(<attribute1 name and attribute1 characteristics,
attribute2 name and attribute2 characteristics,
attribute3 name and attribute3 characteristics,
primary key designation,
foreign key designation and foreign key requirement>);
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
135
1
Using Domains
• Domain is set of permissible values for a column
• Definition requires:
–
–
–
–
Name
Data type
Default value
Domain constraint or condition
CREATE
DOMAIN <domain_name> AS
DATA_TYPE
[DEFAULT <default_value>]
[CHECK (<condition>)]
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
136
1
SQL Integrity Constraints
• Adherence to entity integrity and referential
integrity rules is crucial
– Entity integrity enforced automatically if primary
key specified in CREATE TABLE command
sequence
– Referential integrity can be enforced in
specification of FOREIGN KEY
– Other specifications to ensure conditions met:
• ON DELETE RESTRICT
• ON UPDATE CASCADE
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
137
1
Data Manipulation Commands
Common SQL Commands
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
5.3
138
1
Data Entry and Saving
• Enters data into a table
INSERT
INTO <table name>
VALUES (attribute 1 value, attribute 2 value, … etc.);
• Saves changes to disk
COMMIT
<table names> ;
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
139
1
Listing Table Contents and Other
Commands
• Allows table contents to be listed
SELECT
<attribute names> FROM <table names>;
• UPDATE command makes data entry corrections
• ROLLBACK command restores database back to
previous condition if COMMIT hasn’t been used
• DELETE command removes table row
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
140
1
Queries
• Creating partial listings of table contents
SELECT
<column(s)>
FROM <table name>
WHERE <conditions>;
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
5.4
Mathematical
Operators
141
1
Examples
• Mathematical operators
SELECT
P_DESCRIPT, P_INDATE, P_PRICE, V_CODE
FROM PRODUCT
WHERE V_CODE <> 21344;
• Mathematical operators on character attributes
SELECT
P_CODE,P_DESCRIPT,P_ONHAND,P_MIN,P_PRICE
FROM PRODUCT
WHERE P_CODE < ‘1558-QWI’;
• Mathematical operators on dates
SELECT
P_DESCRIPT,P_ONHAND,P_MIN,P_PRICE,PINDATE
FROM PRODUCT
WHERE P_INDATE >= ‘01/20/2002’;
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
142
1
Computed Columns
• New columns can be created through valid
computations or formulas
– Formulas may contain mathematical operators
– May contain attributes of any tables specified in
FROM clause
• Alias is alternate name given to table or column
in SQL statement
SELECT
P_DESCRIPT,P_ONHAND,P_PRICE,P_ONHAND*P_PRICE
AS TOTVALUE
FROM PRODUCT;
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
143
1
Operators
• Logical: AND, OR, NOT
SELECT
*
FROM PRODUCT
WHERE V_CODE = 21344 OR V_CODE = 24288;
• Rules of precedence
– Conditions within parenthesis executed first
– Boolean algebra
• Special
–
–
–
–
–
BETWEEN - defines limits
IS NULL - checks for nulls
LIKE - checks for similar string
IN - checks for value in a set
EXISTS - opposite of IS NULL
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
144
1
Advanced Data Management
Commands
• ALTER - changes table structure
• ADD - adds column
• MODIFY - changes column characteristics
ALTER
TABLE <table name>
ADD (<column name> <new column characteristics>);
ALTER
TABLE <table name>
MODIFY (<column name> <new column characteristics>);
• Entering data into new column
UPDATE
PRODUCT
SET P_SALECODE = ‘2’
WHERE P_CODE = ‘1546-QQ2’;
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
145
1
Advanced Data Management
Commands (con’t.)
• Dropping a column
ALTER
TABLE VENDOR
DROP COLUMN V_ORDER;
• Arithmetic operators and rules of precedence
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
5.5
146
1
Advanced Data Management
Commands (con’t.)
• Copying parts of tables
INSERT
INTO <receiving table> <receiving table’s column
names>
SELECT <column names of the columns to be copied>
FROM <contributing table name>;
• Deleting a table from database
DROP
TABLE PART;
• Primary and foreign key designation
ALTER
TABLE LINE
ADD PRIMARY KEY (INV_NUMBER, LINE_NUMBER)
ADD FOREIGN KEY (INV_NUMBER) REFERENCES INVOICE
ADD FOREIGN KEY (PROD_CODE) REFERENCES PRODUCT
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
147
• COUNT
Example Aggregate
Function Operations
1
SELECT
COUNT(DISTINCT V_CODE)
FROM PRODUCT;
SELECT
COUNT(DISTINCT V_CODE)
FROM PRODUCT
WHERE P_PRICE <= 10.00;
• MAX and MIN
SELECT
MIN(P_PRICE)
FROM PRODUCT;
SELECT
P_CODE, P_DESCRIPT, P_PRICE
FROM PRODUCT
WHERE P_PRICE = MAX(P_PRICE);
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
148
1
Example Aggregate
Function Operations (con’t.)
• SUM
SELECT
SUM(P_ONHAND * P_PRICE)
FROM PRODUCT;
• AVG
SELECT
P_DESCRIPT, P_ONHAND, P_PRICE, V_CODE
FROM PRODUCT
WHERE P_PRICE >
(SELECT AVG(P_PRICE) FROM PRODUCT)
ORDER BY P_PRICE DESC;
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
149
1
More Complex Queries and SQL
Functions
• Ordering a listing
ORDER
BY
<attributes>
• Results ascending by default
– Descending order uses DESC
ORDER
BY <attributes> DESC
• Cascading order sequence
ORDER
BY <attribute 1, attribute 2, ...>
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
150
1
More Complex Queries and SQL
Functions (con’t.)
• Listing unique values
– DISTINCT clause produces list of different values
SELECT
DISTINCT V_CODE
FROM PRODUCT;
• Aggregate functions
– Mathematical summaries
Table
5.6
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
151
1
More Complex Queries and
SQL Functions (con’t.)
• Grouping data
– Creates frequency distributions
– Only valid when used with SQL arithmetic functions
SELECT
P_SALECODE,
MIN(P_PRICE)
FROM PRODUCT_2
GROUP BY P_SALECODE;
– HAVING clause operates like WHERE for grouping
output
SELECT
V_CODE,COUNT(DISTINCT(P_CODE)),AVG(P_PRICE)
FROM PRODUCT_2
GROUP BY V_CODE
th Edition, Rob & Coronel
Database Systems:
Design, Implementation,
& Management, 5<
HAVING
AVG(P_PRICE)
10;
152
1
More Complex Queries and
SQL Functions (con’t.)
• Virtual tables: creating a view
– CREATE VIEW command
– Creates logical table existing only in virtual memory
CREATE
VIEW PRODUCT_3 AS
SELECT P_DESCRIPT, P_ONHAND, P_PRICE
FROM PRODUCT
WHERE P_PRICE > 50.00;
– SQL indexes
CREATE
INDEX
P_CODEX
ON PRODUCT(P_CODE);
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
153
1
More Complex Queries and
SQL Functions (con’t.)
• Joining database tables
– Data are retrieved from more than one table
SELECT
PRODUCT.P_DESCRIPT, PRODUCT.P_PRICE,
VENDOR.V_NAME, VENDOR.V_CONTACT,
VENDOR.V_AREACODE, VENDOR.V_PHONE
FROM PRODUCT, VENDOR
WHERE PRODUCT.V_CODE = VENDOR.V_CODE;
– Recursive queries joins a table to itself
SELECT
A.EMP_NUM,A.EMP_LNAME,A.EMP_MGR,
B.EMP_LNAME FROM EMP A, EMP B
WHERE A.EMP_MGR=B.EMP_NUM
ORDER BY A.EMP_MGR
– Outer joins can be used when ‘null’ values need to be
included in query result
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
154
1
Updatable Views
• Common operation in production environments is
use of batch routines to update master table
attributes using transaction data
• Overnight batch jobs
• Not all views are updatable
• Restrictions
– GROUP BY expressions cannot be used
– Cannot use set operators---UNION,
INTERSECTION, etc.
– Most restrictions based on use of JOINS or group
operators in views
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
155
Procedural SQL
1
• SQL shortcomings
– Doesn’t support execution of stored procedures based
on logical condition
– Fails to support looping operations
• Solutions
– Embedded SQL can be called from within procedural
programming languages
– Shared Code is isolated and used by all application
programs.
– Procedural SQL (PL/SQL) stored within the database,
executed by DBMS, and invoked by the end user
• Triggers
• Stored procedures
• PL/SQL functions
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
156
1
Procedural SQL (con’t.)
• Procedural SQL allows the use of procedural
code and SQL statements that are stored within
the database.
• The procedural code is executed by the DBMS
when it is invoked by the end user.
• End users can use procedural SQL (PL/SQL) to
create:
– Triggers
– Stored procedures
– PL/SQL functions
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
157
1
Triggers
• Procedural SQL code invoked before or after
data row is selected, inserted, or updated
• Associated with a database table
• Table may have multiple triggers
• Executed as part of transaction
• Can enforce particular constraints
• Automate critical actions and provide warnings
for remedial action
• Can update values, insert records, and call
procedures
• Add processing power
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
158
1
Triggers (con’t.)
• Oracle example
CREATE
OR REPLACE TRIGGER
<trigger_name>
[BEFORE/AFTER]
[DELETE/INSERT/UPDATE OF
<column_name]
ON <table_name>
[FOR EACH ROW]
BEGIN
PL/SQL instructions;
……………
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
159
1
Stored Procedures
• Named collection of procedural and SQL
statements stored in database
• Invoked by name
• Executed as unit
CREATE
OR REPLACE PROCEDURE procedure_name
(argument IN/OUT data-type, etc)
IS/AS BEGIN
DECLARE variable name and data type
PL/SQL or SQL statements;
END;
• Invoked with EXEC
EXEC
store_procedure_name
(parameter, parameter, …)
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
160
1
PL/SQL Stored Functions
• Named group of procedural and SQL statements
that returns a value
CREATE
FUNCTION function_name (argument IN
data-type, etc)
RETURN data-type
AS BEGIN
PL/SQL statements;
RETURN (value); ……
END;
• Invoked from within stored procedures or
triggers
• Cannot be invoked from within SQL statements
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
161
1
Artist Database ERD and Tables
Figure
5.55
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
162
1
General Rules Governing
Relationships Among Tables
Figure
5.56: M:N, Both Sides Mandatory
Figure
5.57: M:N, Both Sides
Optional
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
163
1
General Rules Governing
Relationships Among Tables (Con’t.)
Figure
5.58: M:N, One Side Optional
Figure
5.59: 1:M, Both Sides
Mandatory
Database Systems: Design, Implementation,
& Management, 5th Edition, Rob & Coronel
164
1
General Rules Governing
Relationships Among Tables (Con’t.)
Figure
Figure
5.60: 1:M, Both Sides Optional
5.61: 1:M, Many Side Optional, One Side Mandatory
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
165
1
General Rules Governing
Relationships Among Tables (Con’t.)
Figure
5.62: 1:M, One Side Optional, One Side
Mandatory
Figure
5.63: 1:1, Both Sides
Mandatory
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
166
1
General Rules Governing
Relationships Among Tables (Con’t.)
Figure
Figure
5.64: 1:1, Both Sides Optional
5.65: 1:1, One Side Optional, One Side Mandatory
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
167
1
General Rules Governing
Relationships Among Tables (Con’t.)
Figure
5.66: Weak Entity, Foreign Key Located in Weak Entity
Figure
5.67: Multivalued Attributes (New Table in 1:M
Relationship, Foreign Key CAR_VIN in the New Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
168
1
Chapter 6
Database Design
Database Systems: Design, Implementation, and
Management, Fifth Edition, Rob and Coronel
1
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 subject to
frequent evaluation and revision 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)
• 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
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
170
1
Changing Data into Information
• Data
– Raw facts stored in databases
– Need additional processing to become useful
• Information
– Required by decision maker
– Data processed and presented in a meaningful
form
– Transformation
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
171
1
The Information System
• Database
– Carefully designed and constructed repository of
facts
– Part of an information system
• Information System
– Provides data collection, storage, and retrieval
– Facilitates data transformation
– Components include:
• People
• Hardware
• Software
–Database(s)
–Application
programs
–Procedures
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
172
1
The Information System (Con’t.)
• System Analysis
– Establishes need and extent of an information
system
• Systems development
– Process of creating information system
• Database development
– Process of database design and implementation
– Creation of database models
– Implementation
• Creating storage structure
• Loading data into database
• Providing for data management
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
173
1
Systems Development Life Cycle
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
6.2
174
1
Database Lifecycle (DBLC)
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
6.3
175
1
Phase 1: Database Initial Study
• Purposes
– Analyze company situation
• Operating environment
• Organizational structure
– Define problems and constraints
– Define objectives
– Define scope and boundaries
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
176
1
Initial Study Activities
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
6.4
177
1
Phase 2: Database Design
•
•
•
•
Most Critical DBLC phase
Makes sure final product meets requirements
Focus on data requirements
Subphases
–
–
–
–
Create conceptual design
DBMS software selection
Create logical design
Create physical design
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
178
1
Two Views of Data
Figure
6.5
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
179
1
I. Conceptual Design
• Data modeling creates abstract data structure to
represent real-world items
• High level of abstraction
• Four steps
–
–
–
–
Data analysis and requirements
Entity relationship modeling and normalization
Data model verification
Distributed database design
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
180
1
Data analysis and Requirements
• Focus on:
–
–
–
–
Information needs
Information users
Information sources
Information constitution
• Data sources
– Developing and gathering end-user data views
– Direct observation of current system
– Interfacing with systems design group
• Business rules
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
181
1
Entity Relationship
Modeling and Normalization
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
6.2
182
1
E-R Modeling is Iterative
Figure
6.8
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
183
1
Concept Design: Tools and Sources
Figure
6.9
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
184
1
Data Model Verification
• E-R model is verified against proposed system
processes
– End user views and required transactions
– Access paths, security, concurrency control
– Business-imposed data requirements and
constraints
• Reveals additional entity and attribute details
• Define major components as modules
– Cohesivity
– Coupling
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
185
1
E-R Model Verification Process
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
6.4
186
1
Iterative Process of Verification
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
6.10
187
1
Distributed Database Design
• Design portions in different physical locations
• Development of data distribution and allocation
strategies
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
188
1
II. DBMS Software Selection
• DBMS software selection is critical
• Advantages and disadvantages need study
• Factors affecting purchasing decision
–
–
–
–
–
Cost
DBMS features and tools
Underlying model
Portability
DBMS hardware requirements
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
189
1
III. Logical Design
• Translates conceptual design into internal model
• Maps objects in model to specific DBMS
constructs
• Design components
–
–
–
–
–
–
Tables
Indexes
Views
Transactions
Access authorities
Others
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
190
1
IV. Physical Design
• Selection of data storage and access
characteristics
– Very technical
– More important in older hierarchical and network
models
• Becomes more complex for distributed systems
• Designers favor software that hides physical
details
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
191
1
Physical Organization
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
6.12
192
1
Phase 3: Implementation and Loading
• Creation of special storage-related constructs
to house end-user tables
• Data loaded into tables
• Other issues
–
–
–
–
–
–
Performance
Security
Backup and recovery
Integrity
Company standards
Concurrency controls
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
193
1
Phase 4: Testing and Evaluation
• Database is tested and fine-tuned for
performance, integrity, concurrent access, and
security constraints
• Done in parallel with application programming
• Actions taken if tests fail
–
–
–
–
Fine-tuning based on reference manuals
Modification of physical design
Modification of logical design
Upgrade or change DBMS software or hardware
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
194
1
Phase 5: Operation
•
•
•
•
Database considered operational
Starts process of system evaluation
Unforeseen problems may surface
Demand for change is constant
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
195
1
Phase 6: Maintenance and Evaluation
•
•
•
•
•
Preventative maintenance
Corrective maintenance
Adaptive maintenance
Assignment of access permissions
Generation of database access statistics to
monitor performance
• Periodic security audits based on systemgenerated statistics
• Periodic system usage-summaries
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
196
1
DB Design Strategy Notes
• Top-down
– 1) Identify data sets
– 2) Define data elements
• Bottom-up
– 1) Identify data elements
– 2) Group them into data sets
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
197
1
Top-Down vs. Bottom-Up
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
6.14
198
1
Centralized vs. Decentralized Design
• Centralized design
– Typical of simple databases
– Conducted by single person or small team
• Decentralized design
– Larger numbers of entities and complex relations
– Spread across multiple sites
– Developed by teams
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
199
1
Decentralized Design
Figure
6.16
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
200
1
Chapter 7
The University Lab: Conceptual
Design
Database Systems: Design, Implementation, and
Management, Fifth Edition, Rob and Coronel
1
In this chapter, you will learn:
• How to develop a database initial study
• How to write a description of operations
• How to write business rules on which the
database design is based
• How to translate the business rules into ERD
segments
• How to put the ERD segments together to create
the initial ERD
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
202
1
Database Initial Study
• Detailed description of organization’s current and
proposed superscript database system
environments
– Organizational
•
•
•
•
Objectives
Structure
Operations
Problems
– System
•
•
•
•
Objectives
Scope and boundaries
Information sources and users
End-user requirements
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
203
1
UCL Database Initial Study
• Users
–
–
–
–
–
Assistant Dean, College of Business
Computer Lab Director
Computer Lab Assistants
Computer Lab Secretary
Computer Lab Graduate Assistants
• Objectives
– Provide users with controlled access to UCL
assets
– Guide users working with assets and provide
problem-solving services
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
204
1
UCL’s Organizational Structure
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
7.1
205
1
UCL Description of Operations
• Inventory, storage, order management
– Classifications: hardware, software, literature,
supplies
– Serialized vs. nonserialized items
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
7.2
206
1
UCL Description of Operations (con’t.)
• Equipment maintenance and repair management
– Information kept in Bad Equipment Log and Hardware
Returned for Service Log
• Equipment check-out and check-in management
– Form completed when equipment checked out
– Notice sent for late equipment
• Lab assistant payroll management
– Time sheets used to track assistants
– Hourly basis for a fourteen day period
• Lab reservation management
– Faculty member completes reservation form with date, time,
department, and course number
• Computer lab access management
– Lab users sign users’ log and leave University ID card
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
207
1
Common Problems and
Constraints in Current System
•
•
•
•
•
Never up to date and error-ridden
Too much data duplication and inconsistency
Does not generate useful information
Does not allow ad hoc queries
CLD spends too much time processing data
manually
• Lack of computerization makes inventory
management difficult
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
208
1
Specific Problems
• Inventory/Storage/Order Management
– No access to crucial inventory management data
for CLD
– UCL needs available stock figures & average use
of supplies
– CLD does not know item location
• Equipment maintenance and repair management
– CLD cannot generate history for equipment
– CLD determine the status of items subject to
maintenance procedures
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
209
1
Specific Problems (con’t.)
• Equipment check-out/check-in management
– CLD lacks information about lab assets
• Lab assistant payroll management
– CLD spends too much time summarizing hours
worked LAs
– CLD cannot estimate work loads
• Lab reservations management
– Manual reservation system inadequate
– No statistical information for scheduling lab
reservations
• Computer lab access management
– User log not properly maintained
– Certain items not returned
– Security problems
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
210
1
Constraints for UCL
• Time Frame
– Operational within 3 months
• Hardware and Software
– Use existing UCL hardware and software
• Distributed Aspects and Expandability
– Operate in multiuser environment
– Independent of existing administrative systems
• Cost
–
–
–
–
Development costs must be minimal
Use no more than two additional terminals
Operate without additional personnel
$9,500 is available
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
211
1
Objectives for UCL
• General System Objectives
– Improve operational efficiency
– Provide useful information for planning,
control, and security
• Specific Objectives
– Inventory/Storage/Order Management
•
•
•
•
•
Better purchase order control
Monitor supply item stock
Control inventory by type and item
Quick information about item location
Timely information about use of supplies and
generate stats to aid in future purchases
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
212
1
Specific Objectives for UCL (con’t.)
• Equipment maintenance and repair management
– Monitor maintenance histories
– Track items returned to vendor
• Equipment check-out/check-in management
– Tracks items checked out
– Monitor item check-out time
– Generate usage statistics
• Lab assistant payroll management
– Scheduling and work loads
– Work summaries
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
213
1
Specific Objectives for UCL (con’t.)
• Lab reservations management
– Decrease reservation processing time
– Produce reservation schedules
– Generate statistical summaries
• Computer lab access management
– Control users and lab resources
– Reduce sign-in time
– Provide peak use information for scheduling
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
214
1
Scope and Boundaries
• What will be system’s extent?
– UCL portion of organizational chart
– Independent of other systems
• What operational areas are covered by system?
– Limited to six areas addressed earlier
• What design/ implementation strategy to use?
– Organization into system modules
• What modules should be included in system?
– Lab management
– Inventory management
• How do modules interface?
– Through CHECK_OUT module
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
215
1
Modules and Interfaces
Figure
Table
7.2
7.4
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
216
1
Conceptual Design:
General Systems Requirements
•
•
•
•
•
Easy to use
Provide security measures
Fully integrated
Able to access system concurrently
Perform various functions
– Personnel, inventory, order, maintenance,
reservation, Check_out, and access
• Input driven by output
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
217
1
Conceptual Design Phase
Confirmation of good data sources
From
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
Table 7.5
218
1
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
219
1
Conceptual Design
Phase: User Needs
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
7.3
220
1
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
221
1
Conceptual Design
Phase: Initial Entities
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
7.8
222
1
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
223
1
Business Rule 1
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
7.4
224
1
Business Rule 2
Figure
7.5
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
225
1
Business Rule 3
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
7.6
226
1
Business Rule 4
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
7.7
227
1
Business Rule 5
Figure
7.8
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
228
1
Business Rule 6
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
7.9
229
1
Business Rule 7
Figure
7.10
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
230
1
Business Rule 8
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
7.11
231
1
Business Rule 9
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
7.12
232
1
Business Rule 10
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
7.13
233
1
Business Rule 11
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
7.14
234
1
Business Rule 12
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
7.15
235
1
Business Rule 13
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
7.16
236
1
Business Rule 14
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
7.17
237
1
Business Rule 15
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
7.18
238
1
UCL Entities Considering Business
Rules
Composit
Weak
e
Weak
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
7.10
239
1
Initial
ERD for
UCL
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
240
1
Chapter 8
The University Lab: Conceptual
Design Verification, Logical Design,
and Implementation
Database Systems: Design, Implementation, and
Management, Fifth Edition, Rob and Coronel
1
In this chapter, you will learn:
• How the Lab Management System modules are defined
and refined
• How attributes and domains are identified and
defined for each of the entities defined in the initial E-R
model
• How the database transactions are identified and
defined within the system modules
• That the design verification process uses modeling
and normalization techniques concurrently to find and
eliminate data redundancies
• Review the steps of database implementation
• Review the steps of database testing and evaluation
• Review the steps of database operation
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
242
1
Completing Conceptual
and Logical Design
• Detail Matters!
– Tasks
•
•
•
•
•
•
•
Entity relationship modeling and normalization
Data model verification
Logical design
Physical design
Implementation
Testing and Evaluation
Operation
– Primary modules
• Lab Management System
• Inventory Management System
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
243
1
Entities Identified
Table
8.2
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
244
1
Completion of Conceptual Design
•
Refine module definition
– Entities
– Attributes
• Normalization process
– Discover new entities
– Revise attributes
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
245
1
Lab Management System
Module E-R Segment
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
8.1
246
1
USER Entity
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
8.3
247
1
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
248
1
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
249
LAB_ASSISTANT Entity
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
1
250
1
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
251
WORK_SCHEDULE Entity
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
1
252
1
HOURS_WORKED Entity
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
8.8
253
1
RESERVATION Entity
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
8.9
254
1
Revised RESERVATION Entity
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
8.10
255
1
RES_SLOT (Weak) Entity
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
8.11
256
1
Inventory
Management
Module E-R
Segment
Figure
8.9
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
257
1
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
258
1
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
259
1
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
260
1
INV_Type Entity
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
8.13
261
1
ITEM Entity
Table
Database Systems: Design, Implementation, & Management,
5th
Edition, Rob & Coronel
8.14
262
1
STORAGE Entity
Table
8.15
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
263
1
LOCATION Entity
Table
8.16
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
264
1
REPAIR Entity
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
Table
8.17
265
1
VENDOR Entity
Table
8.18
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
266
1
ORDER Entity
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
Table
8.19
267
1
ORDER_ITEM Entity
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
8.20
268
1
WITHDRAW
Entity Revision
Figure
8.19
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
269
1
WITHDRAW Entity and Revision
Table
8.21
Table
Database Systems: Design, Implementation, & Management,
5th
Edition, Rob & Coronel
8.22
270
1
WD_ITEM (Weak) Entity
Table
8.23
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
271
1
CHECK_OUT
Design
Revision
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
8.22
272
1
CHECK_OUT Entity
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
8.24
273
1
CHECK_OUT_ITEM (Weak) Entity
Table
8.25
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
274
1
E-R Model Verification
• Establishes
– Design reflects end user views of database
– Database transactions defined and modeled so
design supports related requirements
– Design meets output requirements
– Design supports required input screens and data
entry forms
– Design flexible to support future enhancements
• Verification identifies
– Central entity
– Each module and its components
– Each module transaction requirement
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
275
1
Inventory Management
Reporting Problems
• Generates three reports; one is inventory
movement report
– Inventory movements spread across different
entities
– Difficult to generate output and reduces
performance
• Item “quantity on hand” updated with different
inventory movements
– Purchase, withdraw, check-out, check-in, or
inventory adjustment
– Only withdrawals and check-outs represented in
model
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
276
1
Inventory Management
Reporting Problems Solution
• Create new entity as common movement entry
point
• INV_TRANS created
– Standardizes inventory module interfaces
– Facilitates control and generation of required
outputs
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
277
1
Inventory Transaction Process
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
8.25
278
1
INV_TRANS Entity
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
8.26
279
1
TR_ITEM (Weak) Entity
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
8.27
280
1
Initial
ERD for
UCL
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
281
1
Revised
University
Computer
Lab ERD
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
8.28
282
1
Logical Design
• Translates conceptual model to format for
selected DBMS
• Sets stage for creating table structures, indexes,
and views
• Table structures can be created with CREATE
TABLE SQL commands
• Views created with CREATE VIEW SQL
Commands
• Indexes created with CREATE INDEX SQL
Commands
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
283
1
Physical Design
• Defines specific storage or access methods
used by database
• Includes estimate of storage space
• Characteristics are function of DBMS and
operating systems
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
284
1
Implementation
• Database administrator (DBA)
– Controls database management function
– Defines standards and procedures required to
interact with the database
– Adopts appropriate plan
• Plan elements
– Definitions of processes and standards
– Chronology of required activities
• Database creation
• Loading and Conversion
– Documentation standards
– Responsibilities for continued development and
maintenance
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
285
1
Testing and Evaluation
• Determine how well database meets goals
• Ongoing process
• Considerations
– Performance measures
– Security
– Backup and recovery procedures
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
286
1
Operation
• Provides support for daily operations
• Maintains operational procedures
• Database maintenance and evolution
– DBA performs technical and managerial duties to
ensure proper operation of database to support
organizational mission
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
287
1
Chapter 9
Transaction Management and
Concurrency Control
Database Systems: Design, Implementation, and
Management, Fifth Edition, Rob and Coronel
1
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
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
289
1
What is a Transaction?
• Logical unit of work
• Must be either entirely completed or aborted
• No intermediate states are acceptable
Figure
9.1
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
290
1
Example Transaction
• Examine current account balance
SELECT
ACC_NUM, ACC_BALANCE
FROM CHECKACC
WHERE ACC_NUM = ‘0908110638’;
• Consistent state after transaction
• No changes made to Database
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
291
1
Example Transaction
• Register credit sale of 100 units of product X to
customer Y for $500
UPDATE
PRODUCT
SET PROD_QOH = PROD_QOH - 100
WHERE PROD_CODE = ‘X’;
UPDATE ACCT_RECEIVABLE
SET ACCT_BALANCE = ACCT_BALANCE + 500
WHERE ACCT_NUM = ‘Y’;
• Consistent state only if both transactions are fully
completed
• DBMS doesn’t guarantee transaction represents
real-world event
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
292
1
Transaction Properties
• Atomicity
– All transaction operations must be completed
– Incomplete transactions aborted
• Durability
– Permanence of consistent database state
• Serializability
– Conducts transactions in serial order
– Important in multi-user and distributed databases
• Isolation
– Transaction data cannot be reused until its
execution complete
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
293
1
Transaction Management with SQL
• Transaction support
– COMMIT
– ROLLBACK
• User initiated transaction sequence must
continue until:
–
–
–
–
COMMIT statement is reached
ROLLBACK statement is reached
End of a program reached
Program reaches abnormal termination
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
294
1
Transaction Log
• Tracks all transactions that update database
• May be used by ROLLBACK command
• May be used to recover from system failure
• Log stores
– Record for beginning of transaction
– Each SQL statement
•
•
•
•
Operation
Names of objects
Before and after values for updated fields
Pointers to previous and next entries
– Commit Statement
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
295
1
Transaction Log Example
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
9.1
296
1
Concurrency Control
• Coordinates simultaneous transaction execution
in multiprocessing database
– Ensure serializability of transactions in multiuser
database environment
– Potential problems in multiuser environments
• Lost updates
• Uncommitted data
• Inconsistent retrievals
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
297
1
Lost Updates
Table
9.2
Table
9.3
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
298
1
Uncommitted Data
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
Table
9.4
Table
9.5
299
1
Inconsistent Retrievals
Table
9.6
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
9.7
300
1
Inconsistent Retrievals (con’t.)
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
9.8
301
1
The Scheduler
• Establishes order of concurrent transaction
execution
• Interleaves execution of database operations to
ensure serializability
• Bases actions on concurrency control algorithms
– Locking
– Time stamping
• Ensures efficient use of computer’s CPU
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
302
1
Read/Write Conflict Scenarios:
Conflicting Database Operations Matrix
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
9.9
303
1
Concurrency Control
with Locking Methods
• Lock guarantees current transaction
exclusive use of data item
• Acquires lock prior to access
• Lock released when transaction is
completed
• DBMS automatically initiates and enforces
locking procedures
• Managed by lock manager
• Lock granularity indicates level of lock use
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
304
1
Database-Level Locking Sequence
Figure
9.2
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
305
1
Table-Level Lock Example
Figure
9.3
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
306
1
Page-Level Lock Example
Figure
9.4
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
307
1
Row-Level Lock Example
Figure
9.5
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
308
1
Binary Locks
• Two states
– Locked (1)
– Unlocked (0)
• Locked objects unavailable to other objects
– Unlocked objects open to any transaction
– Transaction unlocks object when complete
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
309
1
Example of Binary Lock Table
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
9.10
310
1
Shared/Exclusive Locks
• Shared
– Exists when concurrent transactions granted
READ access
– Produces no conflict for read-only transactions
– Issued when transaction wants to read and
exclusive lock not held on item
• Exclusive
– Exists when access reserved for locking
transaction
– Used when potential for conflict exists
– Issued when transaction wants to update unlocked
data
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
311
1
Problems with Locking
• Transaction schedule may not be serializable
– Managed through two-phase locking
• Schedule may create deadlocks
– Managed by using deadlock detection and
prevention techniques
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
312
1
Two-Phase Locking
• Growing phase
• Shrinking phase
• Governing 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
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
313
1
Two-Phase Locking Protocol
Figure
9.6
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
314
1
Deadlocks
• Occurs when two transactions
wait for each other to unlock data
• Called deadly embrace
• Control techniques
– Deadlock prevention
– Deadlock detection
– Deadlock avoidance
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
315
1
How Deadlock Conditions Created
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
Table
9.11
316
1
Concurrency Control with Time
Stamping Methods
• Assigns global unique time stamp to each
transaction
• Produces order for transaction submission
• Properties
– Uniqueness
– Monotonicity
• DBMS executes conflicting operations in time
stamp order
• Each value requires two additional time stamps
fields
– Last time field read
– Last update
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
317
1
Concurrency Control with
Optimistic Methods
• Assumes most database operations do not
conflict
• Transaction executed without restrictions
until committed
• Phases:
– Read Phase
– Validation Phase
– Write Phase
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
318
1
Database Recovery Management
• Restores a database to previously consistent
state
• Based on the atomic transaction property
• Level of backup
– Full backup
– Differential
– Transaction log
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
319
1
Causes of Database Failure
•
•
•
•
•
Software
Hardware
Programming Exemption
Transaction
External
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
320
1
Transaction Recovery
• Deferred-write and Deferred-update
– Changes are written to the transaction log
– Database updated after transaction reaches
commit point
• Write-through
–
–
–
–
Immediately updated by during execution
Before the transaction reaches its commit point
Transaction log also updated
Transaction fails, database uses log information
to ROLLBACK
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
321
1
Chapter 10
Distributed Database
Management Systems
Database Systems: Design, Implementation, and
Management, Fifth Edition, Rob and Coronel
1
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
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
323
1
Evolution of DDBMS
• Decentralized database management systems (DDBMS)
– Interconnected computer systems
– Data/processing functions reside on multiple sites
• 1970’s: Centralized DBMS
• 1980’s: Social and Technical Changes
– Ad hoc capability required
– Decentralized management structure common
• 1990’s: New forces
– Internet and the World Wide Web used for data access and
distribution
– Data analysis through data mining and data warehousing
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
324
1
DDBMS Advantages
•
•
•
•
•
•
•
•
•
Data located near site with greatest demand
Faster data access
Faster data processing
Growth facilitation
Improved communications
Reduced operating costs
User-friendly interface
Less danger of single-point failure
Processor independence
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
325
1
DDBMS Disadvantages
•
•
•
•
•
•
Complexity of management and control
Security
Lack of standards
Increased storage requirements
Greater difficulty in managing data environment
Increased training costs
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
326
1
Distributed Processing
Shares database’s logical processing among
physically, networked independent sites
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
10.1
327
1
Distributed Database
Stores logically related database over physically
independent sites
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
10.2
328
1
Distributed Database
vs. Distributed Processing
• Distributed processing
– Does not require distributed database
– May be based on a single database on single
computer
– Copies or parts of database processing functions
must be distributed to all data storage sites
• Distributed database
– Requires distributed processing
• Both
– Require a network to connect components
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
329
1
Functions of DDBMS
•
•
•
•
•
•
•
•
•
•
•
•
Application/end user interface
Validation to analyze data requests
Transformation to determine request components
Query optimization to find the best access
strategy
Mapping to determine the data location
I/O interface to read or write data
Formatting to prepare the data for presentation
Security to provide data privacy
Backup and recovery
DB Administration
Concurrency Control
Transaction Management
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
330
1
Centralized Database
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
10.3
331
1
Fully Distributed Database
Management System
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
Figure
10.4
332
1
DDBMS Components
•
•
•
•
Computer workstations
Network hardware and software components
Communications media
Transaction processor (TP)
– Also called application manager (AP) or
transaction manager (TM)
• Data processor (DP)
– Also called data manager (DM)
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
333
1
Distributed Database Components
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
10.5
334
1
DDBMS Protocols
• Interface with network to transport data and
commands between DPs and TPs
• Synchronize data received from DPs and route to
appropriate TPs
• Ensure common database functions
– Security
– Concurrency control
– Backup and recovery
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
335
1
Levels of Data and Process
Distribution
Database systems can be classified based on
process distribution and data distribution
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
10.1
336
1
Single-Site Processing, Single-Site
Data (SPSD)
•
•
•
•
•
•
All processing on single CPU or host computer
All data are stored on host computer disk
DBMS located on the host computer
DBMS accessed by dumb terminals
Typical of mainframe and minicomputer DBMSs
Typical of 1st generation of single-user
microcomputer database
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
337
1
Single-Site Processing, Single-Site
Data (con’t.)
Figure
10.6
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
338
1
Multiple-Site Processing, Single-Site
Data (MPSD)
• Requires network file server
• Applications accessed through LAN
• Variation known as client/server architecture
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
10.7
339
1
Multiple-Site Processing,
Multiple-Site Data (MPMD)
• Fully distributed DDBMS with support for multiple
DPs and TPs at multiple sites
– Homogeneous I
• Integrate one type of centralized DBMS over the
network
– Heterogeneous
• Integrate different types of centralized DBMSs over a
network
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
340
1
Heterogeneous Distributed Database
Scenario
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
10.8
341
1
Distributed DB Transparency
• Allows end users to feel like only database user
• Hides complexities of distributed database
• Transparency features
–
–
–
–
Distribution
Transaction
Failure
Performance
– Heterogeneity
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
342
1
Distribution Transparency
• Allows management of a physically dispersed
database as though it were centralized
• Three Levels
– Fragmentation transparency
– Location transparency
– Local mapping transparency
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
10.2
343
1
Transaction Transparency
• Ensures transactions maintain integrity and
consistency
• Completed only if all involved database sites
complete their part of the transaction
• Management mechanisms
–
–
–
–
Remote request
Remote transaction
Distributed transaction
Distributed request
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
344
1
Remote Request
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
10.10
345
1
Remote Transaction
Figure
10.11
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
346
1
Distributed Transaction
Figure
10.12
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
347
1
Distributed Requests
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
10.13
348
1
Distributed Requests (con’t.)
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
10.14
349
1
Distributed Concurrency Control
• Multisite, multiple-process operations more likely
to create data inconsistencies and deadlocked
transactions
• Problems
– Transaction committed by local DP
– One DP could not commit transaction’s result
– Yields inconsistent database
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
350
1
Two-Phase Commit Protocol
• DO-UNDO-REDO protocol
– Write-ahead protocol
– Two kinds of nodes
• Coordinator
• Subordinates
• Phases
– Preparation
• Coordinator sends message to all subordinates
• Confirms all are ready to commit or abort
– Final Commit
• Ensures all subordinates have committed or aborted
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
351
1
Performance Transparency
and Query Optimization
• Objective: Minimize total cost associated with
execution of request
• Main costs
– Access time
– Communication
– CPU time
• Basis for query optimization algorithms
– Optimum execution order
– Sites accessed to minimize communication costs
• Dynamic or static optimization
• Statistically based vs. rule-based query
optimization algorithms
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
352
1
Distributed Database Design
• Partition database into fragments
– Horizontal
– Vertical
– Mixed
• Fragments to replicate
– Storage of data copies at multiple sites
– Fully, partially, unreplicated databases
• Data allocation
– Where to locate data
– Centralized, partitioned, replicated
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
353
1
Client/Server Advantages Over DDBMS
• Client/server less expensive
• Client/server solutions allow use of
microcomputer’s GUI
• More people with PC skills than mainframe skills
• PC is well established in workplace
• Numerous data analysis and query tools exist
• Considerable cost advantages to off-loading
application development
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
354
1
Client/Server Disadvantages
• Creates more complex environment with different
platforms
• Increased number of users and sites creates
security problems
• Training issues become more complex and
expensive
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
355
1
Date’s 12 Commandments for
Distributed Databases
1. Local Site Independence
2. Central Site Independence
3. Failure Independence
4. Location Transparency
5. Fragmentation Transparency
6. Replication Transparency
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
356
1
Date’s 12 Commandments for
Distributed Databases
7. Distributed Query Processing
8. Distributed Transaction Processing
9. Hardware Independence
10. Operating System Independence
11. Network Independence
12. Database Independence
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
357
1
Chapter 11
Object-Oriented Databases
Database Systems: Design, Implementation, and
Management, Fifth Edition, Rob and Coronel
1
In this chapter, you will learn:
• What basic concepts govern OO systems
• What effect OO concepts are likely to have on
data modeling and design
• How OO features are related to the more
traditional relational and E-R models
• What the basic features of an OO database
management system (OODBMS) are
• About the advantages and disadvantages of
OODBMSs
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
359
1
Object Orientation
• Object Orientation
– Set of design and development principles
– Based on autonomous computer structures
known as objects
• OO Contribution areas
–
–
–
–
–
Programming Languages
Graphical User Interfaces
Databases
Design
Operating Systems
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
360
1
Evolution of OO Concepts
• Concepts stem from object-oriented
programming languages (OOPLs)
– Ada, ALGOL, LISP, SIMULA
• OOPLs goals
–
–
–
–
Easy-to-use development environment
Powerful modeling tools for development
Decrease in development time
Make reusable code
• OO Attributes
– Data set not passive
– Data and procedures bound together
– Objects can act on self
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
361
1
OO Concepts: Objects
• Abstract representation of a real-world entity
– Unique identity
– Embedded properties
– Ability to interact with other objects and self
• OID
– Unique to object
– Not a primary key
• Attributes
– Called instance variables
– Domain
• Object state
– Object values at any given time
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
362
1
OO Concepts: Objects (con’t.)
• Methods
– Code that performs operation on object’s data
– Has name and body
• Messages
– Invokes method
– Sent to object
• Classes
– Collection of similar objects
– Shares attributes and structure
• Protocol
– Represents object’s public aspect
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
363
1
OO Concepts: Objects (con’t.)
• Class hierarchy
– Code that performs operation on object’s data
– Has name and body
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
364
1
Object Characteristics
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
11.7
365
1
Class Hierarchy
• Superclass
• Subclass
• Class lattice
Figure
Database Systems: Design, Implementation, & Management,
5th
Edition, Rob & Coronel
11.8
366
1
Inheritance
• Ability of object to inherit the data structure and
behavior of classes above it
• Single inheritance
– Class has one immediate superclass
Figure
11.9
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
367
1
Inheritance (con’t.)
• Multiple
– Class has more than one immediate superclass
Figure
11.10
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
368
1
Method Overriding
• Method redefined at subclass level
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
11.12
369
1
Polymorphism
Allows different objects to respond to same
message in different ways
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
11.13
370
1
Abstract Data Types (ADT)
• Describes a set of similar objects
• Differs from conventional data types
– Operations are user-defined
– Uses encapsulation
• Definitions needed for creation
– Name
– Data representation
– Abstract data type operations and constraints
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
371
1
Object Classification
• Simple
– Only single-valued attributes
– No attributes refer to other object
• Composite
– At least one multivalued attribute
– No attributes refer to other object
• Compound
– At least one attribute that references other
object
• Hybrid
– Repeating group of attributes
– At least one refers to other object
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
372
1
Characteristics of OODM
•
•
•
•
•
Supports complex objects
Must be extensible
Supports encapsulation
Exhibit inheritance
Supports object identity
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
373
1
OO vs. E-R Model Components
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
11.3
374
1
Shared Representation
for all Objects of the Class Person
Figure
11.14
Figure
Database Systems: Design, Implementation, & Management,
5th
Edition, Rob & Coronel
11.15
375
1
Referential Sharing of Objects
Figure
11.19
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
376
1
Class-Subclass Relationship
Figure
Figure
11.21
11.20
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
377
1
Interobject Relationships
• Attribute-Class Link
• Object’s attribute references another object
• Relationship Representation
– Related classes enclosed in boxes
– Double line on right side indicates mandatory
– Connectivity indicated by labeling each box
• 1:M
• M:N
• M:N with an Intersection Class
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
378
1
1:1 and 1:M Relationships
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
11.24
379
1
Employee-Dependent Relationship
Figure
11.25
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
380
1
Representing the M:N Relationship
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
11.26
381
1
Representing the M:N Relationship
with Associated Attributes
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
11.27
382
1
Representing the M:N Relationship
with Intersection Class
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
11.28
383
1
Object Space Representation
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
11.29
384
1
Late and Early Binding
• Late binding
– Data type of attribute not known until runtime
– Allows different instances of same class to contain
different data types for same attribute
• Early binding
– Allows database to check data type at compilation
or definition time
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
385
1
OODM vs. E-R Data Models
• Object, Entity, and Tuple
– OODM object has behavior, inheritance, and
encapsulation
– OO modeling more natural
• Class, Entity Set, and Table
– Class allows description of data and behavior
– Class allows abstract data types
• Encapsulation and Inheritance
– Object inherits properties of superclasses
– Encapsulation hides data representation and
method
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
386
1
OODM vs. E-R Data Models (con’t.)
• Object ID
– Not supported in
relational models
• Relationships
– OODM
• Interclass
references
• Class hierarchy
inheritance
• Access
– Relational models
• SQL
– OODM
• Navigational
• Set-oriented access
– Relational models
• Value-based
approach
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
387
1
OODBMS
• Database management system integrates
benefits of typical database systems with OODM
characteristics
• Handles a mix of data types
• Follows OO rules
• Follows DBMS rules
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
388
1
OO and Database Design
• Provides data identification and the procedures
for data manipulation
• Data and procedures self-contained entity
• Iterative and incremental
• DBA does more programming
• Lack of standards
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
389
1
OODBMS Advantages
•
•
•
•
•
•
•
•
More semantic information
Support for complex objects
Extensibility of data types
May improve performance with efficient
caching
Versioning
Reusability
Inheritance speeds development and
application
Potential to integrate DBMSs into single
environment
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
390
1
OODBMS Disadvantages
• Strong opposition from the established
RDBMSs
• Lack of theoretical foundation
• Throwback to old pointer systems
• Lack of standard ad hoc query language
• Lack of business data design and management
tools
• Steep learning curve
• Low market presence
• Lack of compatibility between different
OODBMSs
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
391
1
OO Influences on Relational Model
• Extensibility of new user-defined (abstract) data
types
• Complex objects
• Inheritance
• Procedure calls (rules or triggers)
• System-generated identifiers (OID surrogates)
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
392
1
The Next Generation of DBMS
•
•
•
•
•
Object-oriented database systems
Artificial intelligence systems
Expert systems
Distributed database
The Internet
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
393
1
Chapter 12
Client/Server Systems
Database Systems: Design, Implementation, and
Management, Fifth Edition, Rob and Coronel
1
In this chapter, you will learn:
• What client/server computing is
• What the advantages of using client/server
systems are
• How client/server systems evolved
• About client/server systems components and
how they interact
• What effect the client/server system has on the
DBMS
• How client/server systems might be introduced
into an organization
• What factors affect the implementation of
client/server systems
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
395
1
Client/Server Computing
• Computing model for the development of
computerized systems
– Client requests specific service
– Server provides requested service
• Reside on same or different computers
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
Figure
12.1
396
1
Client/Server Computing (con’t.)
• Key to client server power is where request
processing takes place
• Extent of sharing processing
–
–
–
–
Thin client
Thin server
Fat client
Fat server
• Classification
– 2-tier
– 3-tier
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
397
1
Forces that Drive Client/Server Trend
• Changing business environment
• Growing need for enterprise data access
• Demand for end-user productivity gains based on
efficient use of data
• Technological advances
• Growing cost/performance advantages
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
398
1
Evolution of Computing Environment
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
12.2
399
1
Mainframe vs. Client/Server Systems
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
12.1
400
1
Managerial Expectations of
Client/Server Systems
• Client/Server efficiency functions
– Platform independent development
– Optimized distribution of processing activities
among different platforms
– User friendly and cost effective techniques,
methodologies, and specialized tools
• Observations
– Tool, not end goal
– Not answer to all data management problems
– Has own set of management problems
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
401
1
MIS Expectations of
Client/Server Benefits
• Reduced development and implementation costs
• Reduced development time and increased
programmer productivity
• Extended system life cycle through scalability
and portability
• Reduced system operational cost
• Change of MIS function from development to enduser support
• Enhanced information deployment
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
402
1
Organizational Expectations of
Client/Server Benefits
• Flexibility and adaptability
• Improved employee productivity
• Improved company work flow and way to
reengineer business operations
• New opportunities for competitive advantages
• Increased customer service satisfaction
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
403
1
Components of
Client/Server Architecture
• Client
– Front-end application
• Server
– Back-end application
• Communications middleware
– Communications layer
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
12.3
404
1
Example Client/Server Architecture
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
12.4
405
1
Client/Server Principles
• Hardware independence
• Software independence
– Operating systems
– Network systems
– Applications
• Open access to services
• Process distribution
–
–
–
–
Process autonomy
Maximization of local resources
Scalability and flexibility
Interoperability and integration
• Standards
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
406
1
Server Components
•
•
•
•
•
•
•
File services
Print services
Fax services
Communications services
Database services
Transaction services
Miscellaneous services
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
407
1
Server Components
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
Figure
12.6
408
1
Typical Characteristics of
Server Hardware
• Fast CPU
• Fault-tolerant capabilities
–
–
–
–
Dual power
Standby power
Error checking and correcting memory
RAID
• Expandability of CPU, memory, disk, and
peripherals
• Bus support for multiple add-on boards
• Multiple communications options
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
409
1
Server Process Benefits
•
•
•
•
Location independence
Resource optimization
Scalability
Interoperability and integration
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
410
1
Database Middleware
• Network independence
– Front-end application accesses data without
regard to network protocols
• Database server independence
– Generic SQL to access different database servers
– Isolates programmer from SQL dialect differences
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
411
1
Communications Middleware
• Two levels
– Physical level
• Client and server computers
– Logical level
• Client and server processes
• Interprocess communication (ICP) protocols
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
412
1
OSI Network Reference Model
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
12.2
413
1
Information Flow through OSI Model
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
12.7
414
1
Transport Process ID
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
Figure
12.8
415
1
Network Protocols
• Transmission Control Protocol/Internet
Protocol (TCP/IP)
• Internetwork Packet Exchange/ Sequenced
Packet Exchange (IPX/SPX)
• Network Basic Input Output System
(NetBIOS)
• Application Program to Program
Communications (APPC)
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
416
1
Database Middleware Components
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
12.9
417
1
Interactions between
Middleware Components
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
12.10
418
1
Middleware Accessing Multiple
Database Servers
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
12.11
419
1
Middleware Accessing Mainframe
Databases
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
Figure
12.12
420
1
Middleware Classifications
• Messaging-oriented middleware (MOM)
• Remote-procedure-call-based (RPC-based)
middle ware
• Object-based middleware
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
421
1
Competing Standards
• Client operating systems
– Microsoft Windows
– OS/2, Apple Mac OS, Unix, Linux
• Client graphical user interfaces
– Microsoft Windows
– OS/2 Presentation Manager, Macintosh, UNIX
• Server operating systems and network
protocols
– Database servers: Unix, OS/2, Windows NT
Server/2000 Server
– Printer and file servers: Novell Netware
– LAN protocols: TCP/IP, IPX/SPX, NetBIOS
• Middleware
– ODBC, IDAPI, DRDA, Q+E
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
422
1
Client/Server DBMS Functions
• Transparent data access to multiple,
heterogeneous clients
• Allow client requests to the database server over
network
• Process client data requests at local server
• Send only SQL results to clients over network
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
423
1
Application Logic Components
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
12.14
424
1
Client/Server Architectural Styles
• Two Key Questions
– How is the division made?
– Where should the results of division be placed?
• Five Functional Logic Components
–
–
–
–
–
Presentation logic
I/O processing logic
Application of business logic
Data management logic
Data manipulation logic
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
425
1
Application Functional Components
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
12.15
426
1
Functional Logic Splitting
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
12.16
427
1
Client/Server versus Traditional DP
• Proprietary to open systems
• Maintenance-oriented coding to analysis, design,
and service
• Data collection to data deployment
• Centralized to distributed style
• Vertical, inflexible to horizontal, flexible
organizational style
• Differences in IS components
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
428
1
Client/Server Implementation Issues
• Management Issues
–
–
–
–
–
Communications infrastructure
Applications
Controlling escalating and hidden costs
People and cultural changes
Multiple vendor relationships
• Development tool acquisition
• Determination if client/server approach is correct
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
429
1
Chapter 13
The Data Warehouse
Database Systems: Design, Implementation, and
Management, Fifth Edition, Rob and Coronel
1
In this chapter, you will learn:
• How operational data and decision support differ
• What a data warehouse is and how its data are
prepared
• What star schemas are and how they are
constructed
• What steps are required to implement a data
warehouse successfully
• What data mining is and what role it plays in
decision support
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
431
1
The Need for Data Analysis
• External and internal forces require tactical and
strategic decisions
• Search for competitive advantage
• Business environments are dynamic
• Decision-making cycle time is reduced
• Different managers require different decision
support systems (DSS)
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
432
1
Decision
Support Systems
• Decision Support
– Is a methodology
– Extracts information from data
– Uses information as basis for decision making
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
433
1
Decision
Support Systems
• Decision support system (DSS)
– Arrangement of computerized tools
– Used to assist managerial decision
– Extensive data “massaging” to produce
information
– Used at all levels in organization
– Tailored to focus on specific areas and needs
– Interactive
– Provides ad hoc query tools
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
434
1
DSS Components
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
13.1
435
1
Operational vs. Decision Support Data
• Operational data
– Relational, normalized database
– Optimized to support transactions
– Real time updates
• DSS
– Snapshot of operational data
– Summarized
– Large amounts of data
• Data analyst viewpoint
– Timespan
– Granularity
– Dimensionality
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
436
1
The DSS Database Requirements
• Database schema
– Support complex (non-normalized) data
– Extract multidimensional time slices
• Data extraction and filtering
• End-user analytical interface
• Database size
– Very large databases (VLDBs)
– Contains redundant and duplicated data
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
437
1
Data Warehouse
• Integrated
– Centralized
– Holds data retrieved from entire organization
• Subject-Oriented
– Optimized to give answers to diverse questions
– Used by all functional areas
• Time Variant
– Flow of data through time
– Projected data
• Non-Volatile
– Data never removed
– Always growing
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
438
1
Creating a Data Warehouse
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
13.3
439
1
Data Marts
• Single-subject data warehouse subset
• Decision support to small group
• Can be test for exploring potential benefits of
Data warehouses
• Address local or departmental problems
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
440
1
DSS Architectural Styles
•
•
•
•
Traditional mainframe-based OLTP
Managerial information system (MIS) with 3GL
First-generation departmental DSS
First-generation enterprise data warehouse using
RDMS
• Second-generation data warehouse using
MDBMS
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
441
1
Twelve Data Warehouse Rules
1. Separated from operational environment
2. Data are integrated
3. Contains historical data over long time horizon
4. Snapshot data captured at given time
5. Subject-oriented data
6. Mainly read-only data with periodic batch
updates from operational source, no online
updates
7. Development life cycle differs from classical
one, data driven not process driven
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
442
1
Twelve Data Warehouse Rules (Con’t.)
8. Contains different levels of data detail
–
–
Current and old detail
Lightly and highly summarized
9. Characterized by read-only transactions to large
data sets
10. Environment has system to trace data resources,
transformation, and storage
11. Metadata critical components
–
–
Identify and define data elements
Provide the source, transformation, integration, storage,
usage, relationships, and history of data elements
12. Contains charge-back mechanism for usage
–
Enforces optimal use of data
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
443
1
Online Analytical
Processing (OLAP)
• Advanced data analysis environment
• Supports decision making, business modeling,
and operations research activities
• Characteristics of OLAP
–
–
–
–
Use multidimensional data analysis techniques
Provide advanced database support
Provide easy-to-use end-user interfaces
Support client/server architecture
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
444
1
OLAP Client/Server Architecture
Figure
13.6
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
445
1
OLAP Server Arrangement
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
13.7
446
1
OLAP Server with Multidimensional
Data Store Arrangement
Figure
13.8
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
447
1
OLAP Server with
Local Mini-Data-Marts
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
13.9
448
1
Relational OLAP (ROLAP)
• OLAP functionality
• Uses relational DB query tools
• Extensions to RDBMS
– Multidimensional data schema support
– Data access language and query performance
optimized for multidimensional data
– Support for very large databases (VLDBs)
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
449
1
Typical ROLAP
Client/Server Architecture
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
13.10
450
1
Multidimensional OLAP (MOLAP)
• OLAP functionality to multidimensional
databases (MDBMS)
• Stored data in multidimensional data cube
• N-dimensional cubes called hypercubes
• Cube cache memory speeds processing
• Affected by how the database system
handles density of data cube called sparsity
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
451
1
MOLAP Client/Server Architecture
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
13.11
452
1
Star Schema
• Data-modeling technique
• Maps multidimensional decision support into
relational database
• Yield model for multidimensional data analysis
while preserving relational structure of
operational DB
• Four Components:
–
–
–
–
Facts
Dimensions
Attributes
Attribute hierarchies
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
453
1
Simple Star Schema
Figure
13.12
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
454
1
Slice and Dice View of Sales
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
13.14
455
1
Star Schema Representation
• Facts and dimensions represented by physical
tables in data warehouse DB
• Fact table related to each dimension table (M:1)
• Fact and dimension tables related by foreign keys
• Subject to the primary/foreign key constraints
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
456
1
Star Schema for Sales
Figure
13.17
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
457
1
Performance-Improving Techniques
for Star Schema
• Normalization of dimensional tables
• Multiple fact tables representing different
aggregation levels
• Denormalization of the fact tables
• Table partitioning and replication
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
458
1
Data Warehouse
Implementation Road Map
Figure
13.21
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
459
1
Data Mining
• Seeks to discover unknown data characteristics
• Automatically searches data for anomalies and
relationships
• Data mining tools
–
–
–
–
–
Analyze data
Uncover problems or opportunities
Form computer models based on findings
Predict business behavior with models
Require minimal end-user intervention
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
460
1
Extraction of Knowledge from Data
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
13.22
461
1
Data Mining Process
Figure
13.23
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
462
1
Chapter 14
Databases in Electronic
Commerce
Database Systems: Design, Implementation, and
Management, Fifth Edition, Rob and Coronel
1
In this chapter, you will learn:
•
•
•
•
What electronic commerce (e-commerce) is
How e-commerce affects the new economy
About the different e-commerce styles
About the Internet architectural components
required to conduct electronic commerce
• About database design and implementation
issues for electronic commerce applications
• What Extensible Markup Language (XML) is and
why it is important
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
464
1
What is Electronic Commerce?
• Definition
– Bring new products, services, or ideas to market
– Support and enhance business operations
(including sales of products/services over the
Web)
•
•
•
•
Generally identified with Internet use
External evidence is corporate Web site
Prime revenue source
Not an end in itself
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
465
1
E-Commerce Impact
• Changed business environment
• New economy
• Benefits
– Ability to provide quick and convenient
comparison shopping
– 24X7X365 operations
– Global access
– Lower entry barriers
– Increased customer market knowledge
• Disadvantages
–
–
–
–
Hidden costs
Technology is not perfect
Thin profit margins
Security, loss of privacy, service levels, and legal
issues
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
466
1
E-Commerce Styles
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
14.1
467
1
E-Commerce Architecture
• Managerial issues
– Establishing partnerships
• Suppliers
• Distributors
• Vendors
– Design and development of business plans
• Technological issues
– Hardware and software
– Well-planned architecture
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
468
1
E-Commerce Architecture (Con’t.)
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
14.2
469
1
Internet Basic Services
•
•
•
•
•
•
•
•
•
Internet
TCP/IP
Router
WWW
Web Page
HTML
Hyperlink
URL
HTTP
•
•
•
•
•
•
•
•
Web Browser
Web Server
Web Site
Static Web Page
Dynamic Web Page
FTP
E-Mail
News and Discussion
Group Services
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
470
1
Internet Basic Services
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
14.3
471
1
Business Enabling Services
• Search Services
• Security
• Site Monitoring
and Data Analysis
• Load Testing,
Balancing, and
Web Caching
• Usability Testing
•
•
•
•
Personalization
Web Development
Database Integration
Transaction
Processing
• Content Management
• Messaging
• Wireless Device
Support
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
472
1
Security
• Procedures and technology uses
– Protection against accidental and intentional
access
– Warrantee identity of transaction’s participants
• Buyer
• Seller
– Protect transaction data from unauthorized
modifications during Internet travel
– Protect resources (data and computer)
• Customers’ personal data
• Privacy issues
• Property against criminal activities
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
473
1
Sample E-Commerce Transaction
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
Figure
14.4
474
1
Payment Processing
• Digital Cash
– Digital equivalent of hard cash
– Digital certificates verify identity of transaction
participants
– Low transaction costs
– Lack of customer acceptance
• Credit Card purchasing
– Most common for online purchasing
– Secure Electronic Transaction (SET)
• Electronic wallets
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
475
1
Database Design for E-Commerce
• Don’t reinvent the wheel
• No need for ‘new’ design techniques
• Scope
–
–
–
–
–
–
Facilitate sales of products and services
Show products and services
Conduct basic sales transactions
Customer service
Product returns
Web customer profiling
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
476
1
Basic Business Rules
• Sell products
– PRODUCT and CUSTOMER Tables
• Customer may place multiple orders
– 1:M relationship between CUSTOMER and ORDER
• Order contains multiple lines
– 1:M relationship between ORDER and ORDLINE
• Order lines refer to one product
– 1:M between PRODUCT and ORDLINE
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
477
1
Basic Business Rules (Con’t.)
• Customer browses catalog by category
– Each PRODUCT belongs to PRODTYPE
• Customer places products in shopping cart
– SHOPCART belongs to one CUSTOMER and
references one or more PRODUCTS
• Customer checks out and enters credit card and
shipping info
– Added to ORDER
• After credit card authorization order created
– SHOPCARD used to create ORDER with ORDLINEs
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
478
1
Basic Business Rules (Con’t.)
• Merchant offers shipping options
– SHIPOPTION stores details
• Merchant offers many payment options
– PMTOPTION stores details
• States may have different tax rates
– Stored in STATE and TAXRATE
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
479
1
CUSTOMER Table
• Details for each registered customer
• Some customers prefer not to register
• Primary table contents
–
–
–
–
–
–
Name and address information
Login information
Credit card information
Billing information
Shipping information
Membership type
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
480
1
PRODUCT Table
• Central entity in DB
• Some customers prefer not to register
• Primary table contents
–
–
–
–
–
–
Product details
URL of image
Vendor ID
Reorder
Pricing
Alternate item
• May need a PRODOPT table for options within a
particular product
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
481
1
ORDER Table
•
•
•
•
Contains all customer orders
After credit card approval order added to table
One row for each new order
Primary table contents
–
–
–
–
–
–
Order date
Customer ID
Payment and credit card information
Shipping info
Cost info
Status
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
482
1
PRODTYPE Table
• Describes product categories
• Multiple levels
• Primary table contents
– Product type name
– Product type parent
ORDLINE
Table
Contains
items in customer order
One product for each row
Primary table contents
Order ID
Product ID
Database Systems: Design, Implementation, & Management, 5 Edition, Rob & Coronel
Quantity
th
483
1
SHOPCART Table
• Temporarily store products during shopping activity
• Primary table contents
– Product ID
– Quantity
PMTTYPE
Table
Payment
information
Primary table contents
Payment name
Merchant ID used by processing
Database Systems: Design,systems
Implementation, & Management, 5 Edition, Rob & Coronel
th
484
1
SHIPTYPE Table
• Stores different shipping option names
• Primary table contents
– Shipping name
– Cost
TAXRATE
Table
Tax
information
Primary table contents
Rate
State for that rate
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
485
1
STATE Table
• Stores state names
• Primary table contents
– State ID
– State name
PROMOTION
Table
Stores
information about
promotions
Primary table contents
Promotion Name
Promotion details
Database Systems: Design, Implementation, & Management, 5 Edition, Rob & Coronel
Promotion pricing and quantity
th
486
1
PRICEWATCH Table
• Information about particular products customers hope to
buy when the price drops
• Primary table contents
– Customer information
– Product information
PRODPRICE
Manages
Table
multilevel pricing based on
quantity
Primary table contents
Product
Quantity
Database Systems: Design, Implementation, & Management, 5 Edition, Rob & Coronel
Pricing information
th
487
1
Extensible Markup
Language (XML)
• Meta-language
• Represents and manipulates data elements
• Facilitates exchange of structured documents
over the Web
• World Wide Web Consortium (W3C) published
standard definition in 1998
• Allows definition of meta-tags to describe data
elements
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
488
1
XML Characteristics
• Allows definition of new tags
• Case sensitive
– Tags must be well-formed
– Proper nesting required
• Can use <-- and --> to enter comments
• XML or xml prefixes reserved for XML tags only
• Not a replacement for HTML
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
489
1
Contents of ProductList.xml
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
14.5
490
1
Document Type Definition (DTD)
• File with .dtd extension to describe XML
elements
• Provides composition of database’s logical
model
• Defines syntax rules for each XML document
• Defines valid tags
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
491
1
XML Schema
• Advanced data definition language used to
describe structure of XML documents
• Checks for database types
• Validates data for out-of-range values
• XML Schema Definition (XSD) file uses syntax
like XML document
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
492
1
Extensible Style Language (XSL)
• Specifies rules for display of XML data
• Two parts
– Extensible Style Language Transformation (XSLT)
• General mechanism to extract and process data from
one XML document and transform within another
– XSL style sheets
• Defines presentation rules applied to XML elements
• Describes formatting options for different XML
elements
• Limited browser support
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
493
1
Framework for XML Transformations
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
14.10
494
1
XML Applications
•
•
•
•
•
•
•
B2B exchanges
Legacy system integration
Web page development
Database support
Database meta-dictionaries
XML databases
XML services
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
495
1
Chapter 15
Web Database Development
Database Systems: Design, Implementation, and
Management, Fifth Edition, Rob and Coronel
1
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
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
497
1
Web Database Connectivity
• Allows rapid response to competitive pressures
– New services
– New products
• Customer support enhanced
• Fast effective information dissemination
– Universal access
– Local
– Around the globe
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
498
1
Typical Uses of Internet
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
15.2
499
1
Characteristics/Benefits
of Internet Technology
• Hardware & software independence
–
–
–
–
Cost savings
Uses existing equipment
Platform independence and portability
No need for multiple platform development
• Common simple user interface
– Reduced training
– Reduced support
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
500
1
Characteristics/Benefits
of Internet Technology (con’t.)
• Location Independence
– Global access through Internet
– Reduced costs for dedicated connections
• Rapid development at manageable costs
– Development tools
– Low entry costs
– Available software & access tools
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
501
1
Web-to-Database Middleware
• Server-side extension
–
–
–
–
Interacts directly with Web server
Handles specific requests
Also known as Web-to-database middleware
Examples
• ColdFusion
• CGI
• API
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
502
1
Web-to-Database Middleware
Figure
15.1
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
503
1
Web Server Interfaces
• Common Gateway Interface (CGI)
– Uses script files to connect to database
– Perl, C++, VB
• Application Programming Interface (API)
–
–
–
–
Newer and more efficient
Uses DLLs
Memory resident and faster
Well known APIs
• Netscape (NSAPI)
• Internet Server API from Microsoft (ISAPI)
• WebSite API from O’Reilly (WSAPI)
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
504
1
API and CGI Web Server Interfaces
Figure
15.2
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
505
1
Web-to-Database Middleware
Connection Methods
• Native SQL access middleware
• Use services of Open Database Connectivity
(ODBC)
• Use Object Linking and Embedding Database
(OLE DB) interface with Windows
• ODBC most common
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
506
1
ODBC to Access Databases
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
Figure
15.3
507
1
Web-to-Database Middleware Uses
ODBC to Access Databases
Figure
15.4
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
508
1
Web Browser
•
•
•
•
•
Located on the client computer
End user Web interface
Interprets HTML code received from Web server
Presents page components in a standard way
Client-side extensions
– Plug-ins
– Java and JavaScript
– ActiveX and VBScript
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
509
1
ColdFusion
• Web application server
• Uses
–
–
–
–
–
–
–
–
Connect and query database from Web page
Present database data in a Web page
Create dynamic Web search pages
Create Web pages to insert, update, and delete
data
Define required and optional relationships
Define required and optional form fields
Enforce referential integrity in form fields
Use simple and nested queries to represent
business rules
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
510
1
How ColdFusion Works
Figure
Database Systems: Design, Implementation, & Management,
5th
Edition, Rob & Coronel
15.5
511
1
How ColdFusion Works
• Server-side markup language
– HTML extensions
– ColdFusion Markup Language (CFML)
•
•
•
•
Executed in interpreter mode
Contain HTML, CFML
May contain Java, JavaScript, or VBScript
Client browser requests .cfm page from Web
Server
– ColdFusion application server executes .cfm script
– Sends resulting output in HTML to Web Server
– Web server sends to client browser
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
512
1
ColdFusion Tags
• CFQuery
– Queries a database
• CFOutput
– Displays data returned by query
• CFTable
– Displays data in Tabular format
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
513
1
ColdFusion Dynamic Query
• Create script to generate form with criteria used
in database search
• Create script to execute query and display results
– Uses ColdFusion tags
– Uses HTML
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
514
1
The Web as a Stateless System
• Web server does not know status of any client
at any given time
• Request-reply model of communication
• Browser concerned only with current page
• Data processing requires additional software
– Java, JavaScript, VBScript
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
515
1
INSERTs and UPDATEs with
ColdFusion
• CFINSERT Tag
– Adds records to database
– Parameters
• DATASOURCE
• TABLENAME
• CFUPDATE Tag
– Updates selected database contents
– Parameters
• DATASOURCE
• TABLENAME
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
516
1
DELETEs with ColdFusion
• CFQUERY Tag
– Uses SQL DELETE Statement
– Parameters
• DATASOURCE
• TABLENAME
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
517
1
Internet Database: Special
Considerations
• Involve more than just database-enabled Web
applications
• Issues important to corporate databases
–
–
–
–
Data security
Transaction management
Client-side data validation
Operational and management challenges
• Database applications development most
affected by Internet
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
518
1
Supported Data Types
• Integrated data from multiple sources
–
–
–
–
•
•
•
•
Word-processor documents
Pictures
Sounds
Movies
Methods for storing and extracting data objects
Overhead created by storage
Client browser support of object being accessed
Size of database considering multimedia and
other data
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
519
1
Data Security
• Web Server Level
– Secure transactions using encryption
– TCP/IP protocol level
– Firewalls
• RMDBS Vendors
– Login authentication
– Restrict access to particular SQL commands
• Web-to-database middleware
– End user restrictions
– Designer created algorithms
• Must support e-commerce applications
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
520
1
Transaction Management
• Concept is foreign to Web
• Dilemma created by request-reply model
– Web cannot maintain open line between client and
database
– Recovery requires client maintain open
communications
• Designers must ensure proper transaction
management support at database server level
• ColdFusion uses CFTRANSACTION tag for
transaction management support
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
521
1
Denormalization
• Web forms
– Cannot use multiple data entry lines
– 1:M relationships problematic
• Solutions
– Web programming languages
– Java, JavaScript, VBScript
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
522
1
Chapter
16
Database Administration
Database Systems: Design,
Implementation, and Management,
Fifth Edition, Rob and Coronel
1
In this chapter, you will:
• Learn that data are a valuable business asset that
requires careful management
• Learn why and how the database plays a critical role
in an organization
• Learn that the introduction of a DBMS has important
technological, managerial, and cultural organizational
consequences
• Learn what the database administrator's managerial
and technical roles are
• Be introduced to several database administration
tools
• Examine various database administration strategies
• See how various database administration technical
tasks are performed with Oracle
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
524
1
Data as a Corporate Asset
• Raw material used to produce information
• Valuable resource
• Information
– Timely and accurate data can trigger beneficial
actions
– Basis for knowledge
– Used in decision making
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
525
1
Data-Information-Decision Cycle
Figure
16.1
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
526
1
Databases in an Organization
• DBMS facilitates
–
–
–
–
Interpretation and presentation of data
Distribution of data and information
Data preservation and monitoring
Control over data duplication and use
• Supports managerial decision making
– Top
– Middle
– Operational
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
527
1
Introduction of Database
• Big organizational change and challenge
• Process with three primary aspects
– Technological
– Managerial
– Cultural
• Must focus on organizational needs
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
528
1
Evolution of Database Administration
• Roots in decentralized file systems
• Electronic Data Processing (EDP) or Data
Processing (DP) Department
• Information systems (IS) department
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
16.2
529
1
Evolution of Database Administration
(Con’t.)
• Database administration created to handle
complex data management tasks
• Database administrator (DBA) responsible for
control of database
• Factors affecting DBA placement in
organization
– Management style
– Size and complexity of operations
– Geographic distribution of facilities
• General coordinator of all DBAs is systems
administrator (SYSADM)
• Data administrator (DA)
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
530
1
Placement of DBA Function
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
16.3
531
1
DBA Functional Organization
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
16.4
532
1
DA Versus DBA
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
16.1
533
1
Summary of DBA Activities
Figure
16.6
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
534
1
DBA Skills
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
16.2
535
1
DBA Activities and Services
Table
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
16.3
536
1
DBA Service: End-User Support
•
•
•
•
User requirements gathering
Conflict and problem resolution
Finding solutions to information needs
Ensuring quality and integrity of applications
and data
• Building end-user confidence
• Managing the training and support of DBMS
users
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
537
1
DBA Service: Policies, Procedures, &
Standards
• Policies
– General statements of direction or action
– Communicate and support DBA goals
• Standards
– More detailed and specific than policies
– Describe minimum requirement of DBA activity
• Procedures
– Written instructions that describe steps for activity
– Support and enhance work environment
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
538
1
DBA Service: Security,
Privacy, & Integrity
• Authorization management
–
–
–
–
User access management
View definition
DBMS utilities access control
DBMS usage monitoring
• Security breaches
– Preserved integrity
• Data recovery may not be necessary
– Corrupted integrity
• Database must be recovered
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
539
DBA Service: Data Backup
and Recovery
1
• Database security officer (DSO)
• Disaster management
–
–
–
–
–
–
Periodic data and applications backups
Proper backup identification
Convenient and safe backup storage
Physical protection
Personal access control
Insurance coverage for the data in the database
• Data recovery and contingency plans must be
tested and evaluated
• Backup and recovery may not cover all aspects
of IS
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
540
1
DBA Service:
Data Distribution and Use
• Data useful in right hands at right time
• Current philosophy makes authorized data
access easier
• Sophisticated query tools
• Web front ends
• Data democracy
• Cautions due to improper use of data
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
541
1
DBA’s Technical Role
• DBMS and utilities evaluation, selection, and
installation
• Design and implementation of databases and
applications
• Testing and evaluation of databases and
applications
• Operation of the DBMS, utilities, and applications
• Training and supporting users
• Maintenance of the DBMS, utilities, and
applications
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
542
1
DB Administrative Tools:
Data Dictionary
• Integrated data dictionary
– Included with the DBMS
• Stand-alone data dictionary
– From third-party vendor
• Active data dictionary
– Automatically updated by the DBMS
• Passive data dictionary
– Created and updated by a batch process
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
543
1
DB Administrative Tools:
Data Dictionary (Con’t.)
•
•
•
•
•
•
•
•
Data elements in all tables
Tables defined in all databases
Indexes defined for each database table
Defined database specifics
End users and administrators of database
Programs that access database
Access authorizations for all users
Relationships among data elements
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
544
1
DB Administrative
Tools: CASE
• CASE is Computer-Aided Software
Engineering
• Provides automated framework for Systems
Development Life Cycle
• Classifications
– Front-end CASE tools support planning,
analysis, and design
– Back-end CASE tools support coding and
implementation
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
545
1
DB Administrative
Tools: CASE (Con’t.)
• Reduction in development time and costs
• Automation of the SDLC
• Standardization of the systems development
methodologies
• Easier maintenance of application systems
developed with CASE tools
• Improves communications among the DBA,
applications designers, and end users
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
546
1
Data Administration Strategy:
Information Engineering
• Information Engineering (IE) translates
strategic goals of the company into data and
applications
• Focuses on description of corporate data
instead of the processes
• Output is Information Systems Architecture
(ISA)
– Serves as the basis for planning,
development, and control of future IS
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
547
1
Forces Affecting Development of ISA
Figure
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
16.8
548
1
Critical Success Factors for IS
Strategy
•
•
•
•
•
•
Management commitment
Thorough company situation analysis
End-user involvement
Defined standards
Training
Small pilot project
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
549
1
Database Administration Using Oracle
Figure
•
•
•
•
•
16.9
Security Manager
Schema Manager
Storage Manager
SQL Worksheet
Instance Manager
Database Systems: Design, Implementation, & Management, 5th Edition, Rob & Coronel
550
Download