Database Management Systems Chapter 1 Introduction

advertisement
Database Management Systems
Chapter 1
Introduction
Copyright: G. Post, 2002; John Gerdes, Jr, 2002
D
A
T
A
B
A
S
E
File Systems
 A file system determines the organization and
handling of files
 On a DOS computer (and many main-frame
computers) the file system organizes files into
directories.
2
D
A
T
A
B
A
S
E
Why is it important to have a good file
system?
3
D
A
T
A
B
A
S
E
Why is it important to have a good file
system?
 Information cannot be used effectively if stored in an
unorganized, inflexible manner.
 Without proper file management it may be difficult
and even impossible to extract information.
[ 4]
D
A
T
A
B
A
S
E
Old File Method/3GL
Programs
Payroll
Data Definition
File 1
…
File 2
…
Benefits
Data Definition
File 3
File 2
File 4
…
Files
Pay History
Benefits
Employee
Employee
Choices
5
D
A
T
A
B
A
S
E
Drawbacks of Old File Methods?
6
D
A
T
A
B
A
S
E
Drawbacks of Old File Methods
 Uncontrolled Duplication
 Wastes space
 Hard to update all files
 Inconsistent data
 Inflexibility
 Hard to change data
 Hard to change programs
 Limited data sharing
 Poor enforcement of standards
 Poor programmer productivity
 Excessive program maintenance.
[ 7]
D
A
T
A
B
A
S
E
File / Data Method Problems
 File defined in programs
 Cannot read file without its
definition
 Hard to find definition
 Every time you alter file,
you must rewrite code
 Change in a program/file
will crash other code
 Cannot tell which programs
use each file
 Multiuser problems
 Concurrency
 Security
 Access
 Backup & Restore
 Efficiency
 Deadlock
 Indexes
 Programmer talent
 System
 Application.
8
D
A
T
A
B
A
S
E
DBMS: Database Management System
 Database
 A collection of data stored in a standardized format,
designed to be shared by multiple users
 Database Management System
Software that defines a database, stores the data,
supports a query language, produces reports, and
creates data entry screens.
9
D
A
T
A
B
A
S
E
Advantages of Database Approach?
10
D
A
T
A
B
A
S
E
Advantages of Database Approach
 Minimal data redundancy
 Improved data consistency
 Integration of data
 Sharing of data
 Enforcement of standards
 Ease of application development
 Uniform security, privacy and integrity
 Data independence.
[ 11]
D
A
T
A
B
A
S
E
Example of File Method vs DBMS
COBOL
File Division
01 Employees
02 ID
02 Name
02 Address
02 Cell Phone
01 Department
02 ID
02 . . .
More programs
File Division
01 Employees
...
Employee File
112 Davy Jones 999 Elm
Street ... 113 Peter Smith
101 Oak St ...
 Modify file (e.g. Add Cell Phone)
 Write code to copy employee file and
add empty cell phone slot.
 Find all programs that use employee
file.
 Modify file definitions.
 Modify reports (as needed)
 Recompile, fix new bugs.
 Easier Alternative: Keep two
employee files.
12
D
A
T
A
B
A
S
E
Modifying Data with DBMS
 Add cell phone to
employee table
 Open table definition
 Add data element
 If desired, modify reports
 Use report writer
 No programming
 Existing reports,
queries, code will all run
as before with no
changes.
Field Name
Data Type
Description
EmployeeID
TaxpayerID
LastName
FirstName
...
Phone
...
Number
Text
Text
Text
Autonumber..
Federal ID
CellPhone
Text
Text
Cellular . . .
13
D
A
T
A
B
A
S
E
Database Management Approach
 Data is most important
 Data defined first
 Standard format
 Access through DBMS
 Queries, Reports, Forms
 Application Programs
 3GL Interface
All Data
 Data independence
 Change data definition
without changing code
 Alter code without
changing data
 Move/split data without
changing code.
DBMS
Program1
Queries
Program2
Reports
14
Goal: Build a Business Application
Program
SQL
Program
SQL
Design
Tools:
Database Design
SQL (queries)
Programming
Design
D
A
T
A
B
A
S
E
Worst:
Compensate for poor design
and limited SQL with programming
Best:
Spend your time
on design and SQL.
15
D
A
T
A
B
A
S
E
DBMS Features/Components
 Database engine
 Storage
 Retrieval
 Update
 Query Processor
 Data dictionary
 Utilities
 Security
 Report writer
 Forms generator (input
screens)
 Application generator
 Communications
 3GL Interface.
16
D
A
T
A
B
A
S
E
DBMS Engine, Security, Utilities
Product
ItemID Description
Order
887
Dog food
OrderID
ODate
Customer946 Cat food
9874
3-3-97
CustomerID Name
9888
3-9-97
1195
Jones
2355
Rojas
Data
Tables
Product
Customer
ItemID
Integer, Unique
CustomerID
Description Integer,
Text, 100
Unique
char
Name
Text, 50 char
Database
Engine
Data
Dictionary
User Identification
Access Rights
Security
Concurrency and
Lock Manager
Backup and
Recovery
Utilities
Administration
17
D
A
T
A
B
A
S
E
Database Tables (MS Access)
18
D
A
T
A
B
A
S
E
Database Tables (Oracle)
19
D
A
T
A
B
A
S
E
DBMS Query Processor
All Data
Database Engine
Data Dictionary
Query Processor
20
D
A
T
A
B
A
S
E
DBMS Report Writer
All Data
Database Engine
Data Dictionary
Query Processor
Report Writer
Report
Format
& Query
21
D
A
T
A
B
A
S
E
Report Writer (Oracle)
22
D
A
T
A
B
A
S
E
DBMS Input Forms
All Data
Database Engine
Data Dictionary
Query Processor
Form Builder
Input Form
Design
23
D
A
T
A
B
A
S
E
DBMS Components
All Data
Communication
Network
Database Engine
Data Dictionary
Security
3GL
Connector
Query Processor
Form
Report
Builder
Writer
Application
Generator
Program
24
D
A
T
A
B
A
S
E
Examples of Commercial Systems
 Oracle
 Ingres
 Informix (Unix)
 DB2, SQL/DS (IBM)
 Access (Microsoft)
 SQL Server (Microsoft)
 Many older (Focus, IMS, ...)
 Many limited PC (dBASE, Paradox, …).
25
D
A
T
A
B
A
S
E
Types of Database System
 Hierarchical
 Network
 Relational
 Object Oriented.
26
D
A
T
A
B
A
S
E
Hierarchical Database
Customers
Customer
Order
Items Ordered
Orders
Items
Item Description
998 Dog Food
764 Cat Food
Quantity
12
11
To retrieve data, you
must start at the top
(customer). When you
retrieve a customer, you
retrieve all nested data.
27
D
A
T
A
B
A
S
E
Network Database
Entry point
Customer
Order
Items
Ordered
Items
Entry point.
28
D
A
T
A
B
A
S
E
Relational Database
Customer(CustomerID, Name, …
Order(OrderID, CustomerID, OrderDate, …
ItemsOrdered(OrderID, ItemID, Quantity, …
Items(ItemID, Description, Price, …
29
D
A
T
A
B
A
S
E
Object-Oriented DBMS
Order
OrderID
CustomerID
…
NewOrder
DeleteOrder
…
OrderItem
OrderID
ItemID
…
OrderItem
DropOrderItem
…
Customer
CustomerID
Name
…
Add Customer
Drop Customer
Change Address
Item
ItemID
Description
…
New Item
Sell Item
Buy Item …
Government
Customer
Commercial
ContactName
Customer
ContactPhone
ContactName
Discount, …
ContactPhone
…
NewContact
NewContact
• Data structure
similar to
Relational DB
• Addition of
Methods
30
D
A
T
A
B
A
S
E
Why don’t all developers use a DBMS?
 Need specialized personnel
 Programmers
 Designers/Analysts
 Database administrators
 Need to define data for organization
 Cost
 PC:
$400 - $2000
 Medium: $100,000 +
 Large
$ 1,000,000 +
 (California’s Agreement with Oracle was for $126 Million)
 Most new projects (in last 5 years) do use a DBMS.
31
D
A
T
A
B
A
S
E
How do you sell a DBMS approach
to your Boss?
32
D
A
T
A
B
A
S
E
How do you sell a DBMS approach?







Applications change a lot, but use the same data
Need for ad hoc questions and queries
Need for security
Need to reduce development times
Need shared data
Improve quality of data
Enable users to do more of their own development.
[ 33]
Download