Professional Documents
Culture Documents
Management
Systems (DBMS)
1
What is database?
• A DATABASE IS A COLLECTION OF
RELATED DATA OR FACTS. A database
management system (DBMS) is a
software tool that allows people to
store, access, and process data or
facts into useful information.
2
DBMS Benefits
• Though a relational database is more complicated than a
list, it protects us from data anomalies (insert, update, and
delete)
DBMS
• A database management system (DBMS)
defines, creates, and maintains a
database.
DBMS components
DBMS components
• Hardware
• The physical computer system that allows physical access to data
• Software
• The actual program that allows users to access, maintain, and
update physical data
• Data: stored physically on the storage devices
• User: include end users and application programs
• Procedure
• A set of procedures (rules) that should be clearly defined and
followed by the users of the database
• A data model is a collection of concepts for describing
data.
• Relational model
Hierarchical model
Figure 14-4
CIS-552
Introduction
• Data redundancy and inconsistency
• Difficulty in accessing data
• Data isolation – multiple files and formats
• Integrity problems
• Atomicity of updates
• Concurrent access by multiple users
• Security problems 32
Data Independence
• Ability to modify a schema definition in one
level without affecting a schema definition
CIS-552
in the other levels.
• The interfaces between the various levels
Introduction
and components should be well defined so
that changes in some parts do not seriously
influence others.
• Two levels of data independence
• Physical data independence
33
• Logical data independence
Data Models
• A collection of tools for describing:
• Data
• Data relationships
• Data semantics
CIS-552
• Data constraints
• Object-based logical models
Introduction
• Entity-relationship model
• Object-oriented model
• Semantic model
• Functional model
• Record-based logical models
• Relational model (e.g., SQL/DS, DB2)
• Network model
• Hierarchical model (e.g., IMS) 34
Entity-Relationship Model
Example of entity-relationship model
CIS-552
social-security customer-street
account-number
Introduction
customer-name customer-city balance
35
Relational Model
Example of tabular data in the relational model:
name ssn street city account-number
CIS-552
Johnson 192-83-7465 Alma Palo Alto A-101
Smith 019-28-3746 North Rye A-215
Introduction
Johnson 192-83-7465 Alma Palo Alto A-201
Jones 321-12-3123 Main Harrison A-217
Smith 019-28-3746 North Rye A-201
account-number balance
A-101 500
A-201 900
A-215 700
A-217 750
36
Data Definition Language
(DDL)
• Specification notation for defining the database
schema
CIS-552
• DDL compiler generates a set of tables stored in
a data dictionary
Introduction
• Data dictionary contains metadata (data about
data)
• Data storage and definition language – special
type of DDL in which the storage structure and
access methods used by the database system are
specified
37
Data Manipulation Language (DML)
CIS-552
model
• Two classes of languages
Introduction
• Procedural – user specifies what data is
required and how to get those data
• Nonprocedural – user specifies what
data is required without specifying how
to get those data 38
Transaction Management
• A transaction is a collection of operations that
performs a single logical function in a database
CIS-552
application.
• Transaction-management component ensures
Introduction
that the database remains in a consistent
(correct) state despite system failures (e.g.
power failures and operating system crashes)
and transaction failures.
• Concurrency-control manager controls the
interaction among the concurrent transactions,
to ensure the consistency of the database. 39
Storage Management
• A storage manager is a program module that
provides the interface between the low-level
CIS-552
data stored in the database and the application
programs and queries submitted to the system.
Introduction
• The storage manager is responsible for the
following tasks:
• Interaction with the file manager
• Efficient storing, retrieving, and updating of
data 40
Database Administrator
• Coordinates all the activities of the database system; the
database administrator has a good understanding of the
enterprise’s information resources and needs:
CIS-552
• Database administrator’s duties include:
• Schema definition
Introduction
• Storage structure and access method definition
• Schema and physical organization modification
• Granting user authority to access the database
• Specifying integrity constraints
• Acting as liaison with users
• Monitoring performance and responding to changes in
requirements 41
Database Users
• Users are differentiated by the way they expect to interact
with the system.
• Application programmers: interact with system
through DML calls.
CIS-552
• Specialized users: write specialized database
Introduction
applications that do not fit into the traditional
data processing framework
• Sophisticated users: form requests in a database
query language.
• Naive users: invoke one of the permanent
application programs that have been written
previously
42
Figure 14-6
RDBMS
• RDBMS: the relational database management
system (RDBMS)
• Relation: a relation is a 2D table has the following
features:
• Name
• Attributes
• Tuples
Operations on relations
• Insert : unary operation
• Delete : unary operation
• Update : unary operation
• Select : unary operation
• Project : unary operation
• Join : binary operation
• Union : binary operation
• Intersection : binary operation
• Difference : binary operation
Figure 14-7
Figure 14-8
Insert operation
Delete operation
Figure 14-9
Figure 14-10
Update operation
Select operation
Figure 14-12
Join operation
Figure 14-13
Union operation
Figure 14-14
Intersection operation
Figure 14-15
Difference operation
Other database models
• Distributed databases
• The data are stored on several computers that
communicate through the Internet.
• Fragmented distributed databases
• Replicated distributed databases
• Object-oriented databases
• An object-oriented database tries to keep the
advantages of the relational model and at the
same time allows applications to access
structured data.
Problems with Lists: Redundancy
• In a list, each row is intended to stand on its own. As a
result, the same information may be entered several times
(i.e., redundancy)
SALES_ORDERS
SO_Number Item_Number Item_Name Qty_Ordered Cust_Code Cust_Name
1010 2010-0050 Formed Handlebar 2 WHEEL Wheelaway Cycle Center
1000-1 20 in. Bicycle 5 WHEEL Wheelaway Cycle Center
1011 1002-1 24 in. Bicycle 5 ETC Bikes Et Cetera
1001-1 26 in. Bicycle 10 ETC Bikes Et Cetera
1012 1003-1 20 in. Bicycle 5 WHEEL Wheelaway Cycle Center
1001-1 26 in. Bicycle 10 WHEEL Wheelaway Cycle Center
1013 1001-1 26 in. Bicycle 50 IBS Inter. Bicycle Sales
1014 1003-1 20 in. Bicycle 25 ETC Bikes Et Cetera
1015 1003-1 20 in. Bicycle 25 WHEEL Wheelaway Cycle Center
1016 3961-1041 Tire Tube, 26 in. 5 ETC Bikes Et Cetera
3965-1050 Spoke Reflector 50 ETC Bikes Et Cetera
1003-1 20 in. Bicycle 5 ETC Bikes Et Cetera
1000-1 20 in. Bicycle 4 ETC Bikes Et Cetera
Problems with Lists: Multiple Themes
• In a list, each row may contain information on more than one “theme”.
As a result, needed information may appear in the lists only if
information on other themes is also present
S ALES _ORDERS
SO_Num be r Ite m _Num be r Ite m _Na m e Qty_Orde re d Cus t_Code Cus t_Na m e
1010 2010-0050 Form e d Ha ndle ba r 2 WHEEL Whe e la wa y Cycle Ce nte r
1000-1 20 in. Bicycle 5 WHEEL Whe e la wa y Cycle Ce nte r
1011 1002-1 24 in. Bicycle 5 ETC Bike s Et Ce te ra
1001-1 26 in. Bicycle 10 ETC Bike s Et Ce te ra
1012 1003-1 20 in. Bicycle 5 WHEEL Whe e la wa y Cycle Ce nte r
1001-1 26 in. Bicycle 10 WHEEL Whe e la wa y Cycle Ce nte r
1013 1001-1 26 in. Bic yc le 50 IBS Inte r. Bic yc le S ale s
1014 1003-1 20 in. Bicycle 25 ETC Bike s Et Ce te ra
1015 1003-1 20 in. Bicycle 25 WHEEL Whe e la wa y Cycle Ce nte r
1016 3961-1041 Tire Tube , 26 in. 5 ETC Bike s Et Ce te ra
3965-1050 Spoke Re fle ctor 50 ETC Bike s Et Ce te ra
1003-1 20 in. Bicycle 5 ETC Bike s Et Ce te ra
1000-1 20 in. Bicycle 4 ETC Bike s Et Ce te ra
List Modification Issues
• Redundancy and multiple themes create modification problems
Deletion problems
• If we delete SO #1013 we lose our customer IBS
Update problems
• If customer “Bikes Et Cetera” changes its name we have to make sure we
change it in every single row.
Insertion problems
• If we want to add a new customer, we must either wait until they place an order
or (worse) make up a bogus sales order
List Modification Issues
S ALES_ORDERS DELETE
S O_Num be r Ite m _Num be r Ite m _Na m e Qty_Orde re d Cus t_Code Cus t_Na m e No SO
1010 2010-0050 Form e d Ha ndle ba r 2 WHEEL Whe e la wa y Cycle Ce nte r #1013,
1000-1 20 in. Bicycle 5 WHEEL Whe e la wa y Cycle Ce nte r
1011 1002-1 24 in. Bicycle 5 ETC Bike s Et Ce te ra
no IBS
1001-1 26 in. Bicycle 10 ETC Bike s Et Ce te ra
1012 1003-1 20 in. Bicycle 5 WHEEL Whe e la wa y Cycle Ce nte r
1001-1 26 in. Bicycle 10 WHEEL Whe e la wa y Cycle Ce nte r UPDATE
1013 1001-1 26 in. Bic yc le 50 IBS Inte r. Bic yc le S ale s Need to
1014 1003-1 20 in. Bicycle 25 ETC Bike s Et Ce te ra change Et
1015 1003-1 20 in. Bicycle 25 WHEEL Whe e la wa y Cycle Ce nte r Cetera to
1016 3961-1041 Tire Tube , 26 in. 5 ETC Bike s e tc. etc.
3965-1050 S poke Re fle ctor 50 ETC Bike s e tc.
1003-1 20 in. Bicycle 5 ETC Bike s e tc.
1000-1 20 in. Bicycle 4 ETC Bike s e tc.
Ne w (& ric h) Cus tome r INSERT
Blank fields
may cause
problems
later
Relational Databases
• A relational database stores information in tables. Each
informational theme is stored in its own table
• In essence, a relational database will break-up a list into several
parts. One part for each theme in the list
• This is similar to a Web page