Text Books
â˘Modern Database Management
By: Jeffrey A. Hoffer
Tenth edition
3
Course Objectives
ďą
Introduction
ďą
SDLC
ďą
Relational Database System:
understanding, query and report
ďą
Familiarize with tools
4
Lecture Objectives
5
ďą
Basics
ďą
Typical functions of a DBMS.
ďą
Major components of the DBMS environment.
ďą
Personnel involved in the DBMS environment.
ďą
History of the development of DBMSs.
ďą
Advantages and disadvantages of DBMSs.
Introduction: What Is
Database?
â˘A very large, integrated collection of data.
â˘Database: An organized collection of logically related data.
â˘A database management system (DBMS) is a software system
designed to store, manage and facilitate access to the
database
6
7
Types of Databases and
Database Applications
ďŽNumeric and Textual Databases
ďŽMultimedia Databases
ďŽGeographic Information Systems (GIS)
ďŽData Warehouses
Examples of Database
Applications
ďą
Purchases from the supermarket
ďą
Purchases using your credit card
ďą
Booking a holiday at the travel agents
ďą
Using the local library
ďą
Taking out insurance
ďą
Using the Internet
ďą
Studying at university
File Processing Systems
9
Registration
Applications
Registration
Data
Files
Registration
Examination
Applications
Examination
Data
Files
Examination
Library
Applications
Library
Data
Files
Library
Program and Data Interdependence
File Processing Systems
10
Fine
Books Issued
Father Name
Name
Reg_Number
Library
Grade
Semester
Class
Address
Name
Reg_Number
Examination
Class
Address
Phone
Father Name
Name
Reg_Number
Registration
11
Advantages of Database ApproachAdvantages of Database Approach
RegistrationExamination
Library
Applications
Library
Examination
Applications
Registration
Applications
Database
Management
System
University
Students
Database
- Data Sharing - Data Independence
- Controlled Redundancy - Better Data Integrity
The concept of a shared organizational
database
12
Accounting
Accounts
Payable
Accounts
Receivable
Management
ControlPlanning
Manufacturing
ProductionScheduling
Marketing
Product
Development
Sales
Corporate
Database
Types of Data
â˘Structured Data
â˘Unstructured Data
13
Definitions
â˘Data: Meaningful facts, text, graphics, images, sound, video
segments
â˘Information: Data processed to be useful in decision making
â˘Metadata: Data that describes data
14
15
Figure: Data in Context
16
Figure: Summarized data
Useful information that managers can use for
decision making and interpretation
17
Table: Metadata
Descriptions of the properties or characteristics of the
data, including data types, field sizes, allowable
values, and documentation
What is DBMS
â˘A Database Management System (DBMS) is a software
package designed to store and manage databases.
â˘A DBMS is a data storage and retrieval system which permits
data to be stored non-redundantly while making it appear to
the user as if the data is well-integrated.
18
Database Management
System
19
DBMS manages data
resources like an operating
system manages hardware
resources
DBMS
Database
containing
centralized
shared data
Application
#1
Application
#2
Application
#3
A simplified database system environment
20
21
Typical DBMS Functionality
ďŽDefine a database : in terms of data types,
structures and constraints
ďŽConstruct or Load the Database on a
secondary storage medium
ďŽManipulating the database : querying,
generating reports, insertions, deletions and
modifications to its content
ďŽConcurrent Processing and Sharing by a set of
users and programs â yet, keeping all data valid
and consistent
22
Typical DBMS Functionality
Other features:
ďą
Protection or Security measures to
prevent unauthorized access
ďą
âActiveâ processing to take internal
actions on data
ďą
Presentation and Visualization of data
Data Models
â˘Data model is collection of concepts for describing data.
â˘Graphical systems used to capture the nature and
relationships among data.
â˘Entity
â˘Relationships
23
Relational data Model
â˘Widely used model today
â˘Main concept: Relation, a table with rows and columns
24
Example
â˘Part of a UNIVERSITY environment.
â˘Some entities:
- STUDENTs
- COURSEs
- SECTIONs (of COURSEs)
- (academic) DEPARTMENTs
- INSTRUCTORs
â˘Some relationships:
- SECTIONs are of specific COURSEs
- COURSEs have prerequisite COURSEs
- INSTRUCTORs teach SECTIONs
- COURSEs are offered by DEPARTMENTs
- STUDENTs major in DEPARTMENTs
25
26
27
Define UNIVERSITY databaseDefine UNIVERSITY database
Structure of the record
STUDENT ( Name , Number, Class, Major)
COURSE ( Name , Number, Credit, Dept.)
Data type of data element
Name: a string of characters
Number: integer
Grade: {A,B,C,D,F,I}
âŚ..
Constraints
The sections that students take must be taught by some instructors.
28
Construct UNIVERSITY databaseConstruct UNIVERSITY database
Store data on storage medium
-store data for each student, course, section, grade repot, prerequisite
records in various files may be related to one another
Manipulate UNIVERSITY databaseManipulate UNIVERSITY database
Query:
Retrieve the transcript ( a list of all courses and grades) of Smith.
Update:
Create a new section for the database course for this semester.
The concept of a shared organizational
database
29
Accounting
Accounts
Payable
Accounts
Receivable
Management
ControlPlanning
Manufacturing
ProductionScheduling
Marketing
Product
Development
Sales
Corporate
Database
File Processing Systems
30
Registration
Applications
Registration
Data
Files
Registration
Examination
Applications
Examination
Data
Files
Examination
Library
Applications
Library
Data
Files
Library
Program and Data Interdependence
File Processing Systems
31
Fine
Books Issued
Father Name
Name
Reg_Number
Library
Grade
Semester
Class
Address
Name
Reg_Number
Examination
Class
Address
Phone
Father Name
Name
Reg_Number
Registration
Disadvantages of File Processing
â˘Program-Data Dependence
All programs maintain metadata for each file they use
â˘Data Redundancy (Duplication of data)
Different systems/programs have separate copies of the same data
â˘Limited Data Sharing
No centralized control of data
â˘Lengthy Development Times
Programmers must design their own file formats
â˘Excessive Program Maintenance
80% of information systems budget
32
33
Figure: Three file processing systems at Pine Valley
Furniture
Duplicate
Data
Problems with Data Dependency
ďEach application programmer must maintain their
own data
ďEach application program needs to include code for
the metadata of each file
ďEach application program must have its own
processing routines for reading, inserting, updating
and deleting data
ďLack of coordination and central control
ďNon-standard file formats
34
Problems with Data
Redundancy
â˘Waste of space to have duplicate data
â˘Causes more maintenance headaches
â˘The biggest Problem:
â˘When data changes in one file, could cause
inconsistencies
â˘Compromises data integrity
35
SOLUTION:
The DATABASE Approach
â˘Central repository of shared data
â˘Data is managed by a controlling agent
â˘Stored in a standardized, convenient form
36
Requires a Database Management System (DBMS)
37
Advantages of Database ApproachAdvantages of Database Approach
RegistrationExamination
Library
Applications
Library
Examination
Applications
Registration
Applications
Database
Management
System
University
Students
Database
- Data Sharing - Data Independence
- Controlled Redundancy - Better Data Integrity
Why use a DBMS
â˘Program-Data Independence
â˘Metadata stored in DBMS, so applications donât need to worry about
data formats
â˘Data queries/updates managed by DBMS so programs donât need to
process data access routines
â˘Results in: increased application development and maintenance
productivity
â˘Minimal Data Redundancy
â˘Leads to increased data integrity/consistency
38
Advantages of Database Approach
â˘Improved Data Sharing
â˘Different users get different views of the data
â˘Enforcement of Standards
â˘All data access is done in the same way
â˘Improved Data Quality
â˘Constraints, data validation rules
â˘Better Data Accessibility/ Responsiveness
â˘Use of standard data query language (SQL)
â˘Security, Backup/Recovery, Concurrency
â˘Disaster recovery is easier
39
Costs and Risks of the
Database Approach
â˘Up-front costs:
â˘Installation Management Cost and Complexity
â˘Conversion Costs
â˘Ongoing Costs
â˘Requires New, Specialized Personnel
â˘Need for Explicit Backup and Recovery
â˘Organizational Conflict
â˘Old habits die hard
40
Components of database
environment
â˘CASE Tools â computer-aided software engineering
â˘Repository â centralized storehouse of metadata
â˘Database Management System (DBMS) â software for managing the
database
â˘Database â storehouse of the data
â˘Application Programs â software using the data
â˘User Interface â text and graphical displays to users
â˘Data Administrators â personnel responsible for maintaining the
database
â˘System Developers â personnel responsible for designing databases
and software
â˘End Users â people who use the applications and databases
41
42
Figure:
Components
of the
database
environment
Conversion to database
approach
â˘Step 1:
Enterprise Data model: Graphical model that shows high level
entities for organization and associations among these
entities.
ď§Step 2:
Relational Data Model: Defining tables for each entity.
ď§Step 3:
Implement
43
Continued..
â˘A data model is a collection of concepts for
describing data.
â˘A schema is a description of a particular collection of
data, using the given data model.
â˘The relational model of data is the most widely used
model today.
- Main concept: relation, basically a table
with rows and columns.
- Every relation has a schema, which
describes the columns, or fields
44
Segment from enterprise data
model
45
46
One customer may place many
orders, but each order is placed
by a single customer
ď One-to-many relationship
47
Therefore, one order involves
many products and one product
is involved in many orders
ď Many-to-many relationship
48
Database Users
Users may be divided into those who
actually use and control the content (called
âActors on the Sceneâ) and those who
enable the database to be developed and
the DBMS software to be designed and
implemented (called âWorkers Behind the
Sceneâ).
49
Database Users
Actors on the scene
ďąDatabase administrators: responsible for authorizing
access to the database, for co-ordinating and monitoring
its use, acquiring software, and hardware resources,
controlling its use and monitoring efficiency of
operations.
ďąDatabase Designers: responsible to define the content,
the structure, the constraints, and functions or
transactions against the database. They must
communicate with the end-users and understand their
needs.
ďąEnd-users: they use the data for queries, reports and
some of them actually update the database content.
Categories of End users
â˘Sophisticated Users: these include business
analysts, scientists, engineers, others thoroughly
familiar with the system capabilities. Many use tools
in the form of software packages that work closely
with the stored database.
â˘Naive Users: They donât need to know any details of
structure. They access the database by writing
simple commands or by choosing operations from
menus.
50
Workers behind the scene
Persons whose job involves design, development,
operation,and maintenance of the DBMS software and
system environment.
â˘DBMS designers and implementers: Design and implement
the DBMS software package itself.
⢠Tool developers: Design and implement tools that
facilitate the use of the DBMS software. Tools include
design tools, performance tools, special interfaces,etc.
⢠Operators and maintenance personnel: Work on running
and maintaining the hardware and software environment
for the database system.
51
52
Figure
Client/server
system
The Range of
Database Applications
â˘Personal Database â standalone desktop database
â˘Workgroup Database â local area network (<25 users)
â˘Department Database â local area network (25-100 users)
â˘Enterprise Database â wide-area network (hundreds or thousands
of users)
53
54
Figure: Typical
data from a
personal
computer
database
55
Figure: Workgroup database with local area network
When not to use DBMS
Main costs of using a DBMS:
- High initial investment in hardware, software,training
and possible need for additional hardware.
- Overhead for providing generality, security, recovery, integrity,
and concurrency control.
- Generality that a DBMS provides for defining and processing
data.
When a DBMS may be unnecessary:
- If the database and applications are simple, well defined, and
not
expected to change.
- If there are stringent real-time requirements that may not be
met
because of DBMS overhead.
- If access to data by multiple users is not required.
58
Reference Reading
â˘Chapter 1
59
Q & A
SQL
â˘Data Definition Language (DDL)
â˘Create/alter/delete tables and their attributes
â˘Following lectures...
â˘Data Manipulation Language (DML)
â˘Query one or more tables â discussed next !
â˘Insert/delete/modify tuples in tables
Tables in SQL
PName Price CategoryManufacturer
Gizmo $19.99 GadgetsGizmoWorks
Powergizmo $29.99 GadgetsGizmoWorks
SingleTouch$149.99Photography Canon
MultiTouch $203.99 Household Hitachi
Product
Attribute names
Table name
Tuples or rows
Tables Explained
â˘The schema of a table is the table name and its attributes:
Product(PName, Price, Category, Manfacturer)
â˘A key is an attribute whose values are unique;
we underline a key
Product(PName, Price, Category, Manfacturer)
Data Types in SQL
â˘Atomic types:
â˘Characters: CHAR(20), VARCHAR(50)
â˘Numbers: INT, BIGINT, SMALLINT, FLOAT
â˘Others: MONEY, DATETIME, âŚ
â˘Every attribute must have an atomic type
â˘Hence tables are flat
â˘Why ?
â˘CREATE TABLE table_name (
   column1 datatype,
   column2 datatype,
   column3 datatype,
  ....
);
65
CREATEÂ TABLEÂ Persons (
   PersonID int,
   LastName varchar( 255),
   FirstName varchar( 255),
   Address varchar( 255),
   City varchar(255)
);