Chapter (1) - Introduction
Chapter (1) - Introduction
Introduction to Databases
Ahmed M. Zeki
ITIS 213
Objectives
Some common uses of database systems.
Characteristics of file-based systems.
Problems with file-based approach.
Meaning of the term database.
Meaning of the term Database Management System
(DBMS).
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.
2 / 66
Introduction
The importance of DB System has increased with
the significant developments in:
◦ Hardware capability
◦ Hardware capacity
◦ Communication
Emergence of the Internet
Electronic Commerce
Business Intelligence
Mobile Communications
Grid Computing
3 / 66
Introduction
The DB system is arguably the most important
development in the field of SE.
The DB is now the underlying framework of the IS.
DB is fundamentally changing the way that many
organizations operate.
DB technology has been the catalyst for many
development.
4 / 66
Database Applications
DB is now an integral part of our day-to-day life
that often we are not aware we are using one.
DB is a collection of related data.
DBMS is the software that manages and controls
5 / 66
Examples of Database Applications
Purchases from the supermarket
◦ Bar code reader
◦ Linked to an application program
◦ Find out the price
◦ Product DB
◦ Reduce the number of such items in stock
◦ Display the price
◦ Automatically place an order
6 / 66
Examples of Database Applications
Purchases using your credit card
◦ Sufficient credit left to make the purchase
◦ DB application program
◦ The price is within the credit limit
◦ The credit card is not on the list of stolen or lost cards
◦ Monthly statement application
7 / 66
Examples of Database Applications
Booking a holiday at the travel agents
◦ Two different agents don’t book the same holiday or
overbook the seats on the flight.
◦ Separate DB for invoicing.
8 / 66
Examples of Database Applications
Using the local library
◦ Details of the books
◦ Details of the readers
◦ Reservations
◦ Allow readers to find a book based on its title, authors, or
subject areas
◦ Reminders to borrowers
◦ Barcode readers
9 / 66
Examples of Database Applications
Taking out insurance
◦ Personal details
◦ Determining the cost of insurance
◦ The broker can search several DBs to find the organization
that gives the best deal
10 / 66
Examples of Database Applications
Renting a video
◦ Available video titles
◦ Number of copies available
◦ Availability of a copy / on loan
◦ Which videos they are currently renting
◦ Dates they are returned
◦ Predicting future buying
11 / 66
Examples of Database Applications
Using the Internet
◦ Many sites are driven by DB applications
Online bookstores
◦ Browse by categories, authors, etc
◦ Display shipping, stock levels, and on-order information
◦ Sales history
◦ Reviews
◦ Cross reference: listed under different categories
◦ Credit card details
◦ Personalization of services for customers
◦ Keeping records of previous transactions
◦ Recommended titles based on previous purchases
12 / 66
Examples of Database Applications
Studying at university
◦ Students information
◦ Courses you are enrolled in, you have taken in the past
◦ Details about the grant
◦ Examination results
◦ Next year admission
◦ University staff
13 / 66
File-Based Systems
Early attempts to computerize the manual filing
systems
Collection of application programs that perform
14 / 66
File-Based Systems
Search through the system starting from the first
entry until we find what we want.
Indexing system
15 / 66
File-Based Systems
Works well while the number of items to be stored is
small.
16 / 66
File-Based Systems
Difficult to answer those questions?.
◦ What 3-bedroom properties do you have for sale with a
garden and garage?
◦ What flats do you have for rent within three miles of the
city centre?
◦ What is the average rent for a two bedroom flat?
◦ What is the total annual salary bill for staff?
◦ How does last month’s turnover compare with the projected
figure for this month?
◦ What is the expected monthly turnover for the next finical
year?
17 / 66
File-Based Systems
A decentralized approach was taken first.
◦ Each department stores and controls its own data with the
assistance of the Data Processing (DP) staff.
Example of DreamDepartment
◦ Forms are filled up by the DP
A file is a collection of records which contains
logically related data.
Each record contains a logically connected set of
object.
18 / 66
File-Based Systems
Each Dept accesses its own files and handles its own data
entry, file maintenance, and the generation of reports.
19 / 66
Limitations of File-Based Approach
Separation and isolation of data
◦ Each program maintains its own set of data.
◦ Difficult to access data.
◦ Users of one program may be unaware of
potentially useful data held by other programs.
20 / 66
Limitations of File-Based Approach
Duplication of data
◦ Same data is held by different programs.
◦ Wasted space and potentially different values and/or
different formats for the same item.
◦ It costs time and money to enter the data more than
once.
◦ Loss of data integrity, data is no longer consistent.
21 / 66
Limitations of File-Based Approach
◦ Example: if a member of staff moves house and the
change of address is communicated only to Personnel and
not to Payroll, the person’s payslip will be sent to the
wrong address.
◦ Example: an employee is promoted with an associated
increase in salary.
◦ When the error is detected, it will take time and effort to
resolve.
◦ No automatic way for Personnel to update the data in the
Payroll files. Even if Payroll is notified of the changes, it is
possible that the data will be entered incorrectly.
22 / 66
Limitations of File-Based Approach
Data dependence
◦ File structure is defined in the application code, i.e
changes to an existing structure are difficult to make.
Example increasing the size of a field from 40 to 41
characters.
Open original file for reading
Create temporary file with the new structure
Read a record from the original file, convert the data to
conform to the new structure, and write it to the temporary
file. Repeat for all records.
Delete the original file
Rename the temporary as the original
All programs accessing the original file must be modified to
conform to the new structure. (This characteristic of file-based
system is called program-data dependence)
23 / 66
Limitations of File-Based Approach
Incompatible file formats
◦ Programs are written in different languages, and so
cannot easily access each other’s files.
24 / 66
Limitations of File-Based Approach
Fixed Queries/Proliferation of application programs
◦ i.e. Not ad-hoc or unplanned queries.
◦ Programs are written to satisfy particular functions.
◦ Any new requirement needs a new program.
25 / 66
Limitations of File-Based Approach
All this put tremendous pressure on the DP staff
26 / 66
Database Approach
Arose because:
◦ Definition of data was embedded in application
programs, rather than being stored separately and
independently.
◦ No control over access and manipulation of data beyond
that imposed by application programs.
Result:
◦ the database and Database Management System
(DBMS).
27 / 66
Database
Shared collection of logically related data (and a
description of this data), designed to meet the
information needs of an organization.
28 / 66
Database
DB is no longer owned by one department, but is a
shared corporate resource.
29 / 66
Database
Definition of data is separated from the application
programs. Similar to the approaches taken in
modern software development.
◦ The users see only the external definition and are unaware
of how the object is defined and how it functions.
30 / 66
Database
◦ If new data structures are added or existing structures are
modified then the application programs are unaffected,
provided they don’t directly depend upon what has been
modified.
31 / 66
Database
Logically related data comprises entities, attributes,
and relationships of an organization’s information.
33 / 66
DBMS
Allows users to define the DB, usually
through Data Definition Language (DDL),
which allows users to specify the data types
and structures and the constrains on the data
to be stored in the DB.
35 / 66
DB Application Program
A computer program that interacts with the
DB by issuing an appropriate request
(typically an SQL statement) to the DBMS.
36 / 66
Database Management System (DBMS)
38 / 66
Views - Benefits
Reduce complexity
Provide a level of security
Provide a mechanism to customize the appearance
of the database
Present a consistent, unchanging picture of the
39 / 66
Components of DBMS Environment
40 / 66
Components of DBMS Environment
1. Hardware
◦ Applications require hardware to run.
◦ Can range from a PC to a network of computers.
◦ Hardware depends on:
The organization’s requirement.
The DBMS, because some DBMS run only on certain
OSs and hardware.
◦ DBMS requires minimum amount of RAM and disk space.
41 / 66
Components of DBMS Environment
DB backend: part of the DBMS that manages and
controls access to the DB. (Server)
42 / 66
Components of DBMS Environment
2. Software: consists of:
◦ DBMS
◦ OS
◦ Network software (if necessary)
◦ Application programs: written in 3GL such as C,
C++, Java, etc, or 4GL such as SQL embedded in a
3GL.
DBMS may have its own 4GL tools
44 / 66
Components of DBMS Environment
4. Procedures
◦ Instructions and rules that govern the design and
use of the database and DBMS.
45 / 66
Components of DBMS Environment
◦ Users and DBAs require documented procedure:
Log on to the DBMS
Use a particular DBMS facility or application program
Start and stop the DBMS
Make backup copies of the DB
Handle hardware or software failures.
How to identify the failed component
How to fix
How to recover the DB
Change the structure of a table
Recognize the DB across multiple disks
Improve performance
Archive data to secondary storage
46 / 66
Components of DBMS Environment
5. People
◦ Data Administrator (DA): responsible for the management
of the data resource including:
DB planning development
Maintenance of standards, policies and procedures
Conceptual/logical DB design.
47 / 66
Components of DBMS Environment
5. People
◦ Database Administrator (DBA): responsible for physical
realization of the DB including:
Physical DB design and implementation
Security and integrity control
Maintenance of the operational system
Ensuring satisfactory performance of the applications of users
48 / 66
Components of DBMS Environment
5. People
◦ The role of the DBA is more technically oriented than the
role of the DA, requiring detailed knowledge of the target
DBMS and the system environment.
49 / 66
Components of DBMS Environment
5. People
A. Logical DB Designer: is concerned with identifying:
The data (i.e. Entities and Attributes)
The relationships between the data
The constraints (business rules) on the data that is to be stored
in the DB
50 / 66
Components of DBMS Environment
5. People
◦ Constraints: describe the main characteristics of the data as
viewed by the organization:
A member of staff can’t manage more than 100 properties for
rent or sale at the same time
A member of staff can’t handle the sale or rent of his own
property
A solicitor can’t act for both the buyer and seller of a property
52 / 66
Components of DBMS Environment
5. People
B. Physical DB designer decides how the logical DB design is
to be physically realized which involves:
Mapping the logical DB design into a set of tables and integrity
constraints
Selecting specific storage structures and access methods for the
data to achieve good performance
Designing any security measures required on the data
53 / 66
Components of DBMS Environment
5. People
◦ Many parts of physical DB design are highly dependent on
the target DBMS and there may be more than one way of
implementing a mechanism. Hence the physical DB designer:
Must be fully aware of the functionality of the target DBMS
Must understand the advantages and disadvantages of each
alternative for a particular implementation.
Must be capable of selecting a suitable storage strategy that takes
account of usage.
54 / 66
Components of DBMS Environment
5. People
◦ Application Developer: responsible for developing
application programs that provide the required functionality
for the end-users.
◦ The application developers work from a specification
produced by systems analysts.
◦ Each program contains statements that request the DBMS to
perform some operation on the DB.
Retrieving data, inserting, updating, and deleting data.
◦ The programs may be written in a 3GL or a 4GL.
55 / 66
Components of DBMS Environment
5. People
◦ End-users (clients):
Naive users:
Unaware of the DBMS
They access the DB through specially written applications programs
that attempt to make the operations as simple as possible.
They invoke DB operations by entering simple commands or
choosing options from a menu.
They do not need to know anything about the DB or the DBMS.
The checkout assistant at the local supermarket uses a bar code reader
to find out the price of the item. The rest of the job is done by the
program.
56 / 66
Components of DBMS Environment
5. People
◦ End-users (clients):
Sophisticated users:
Familiar with the structure of the DB and the facilities offered by the
DBMS.
May use the high-level query language such as SQL to perform the
required operations.
May write applications for their own use.
57 / 66
History of Database Systems
File-based system
DBMS – 1960s
1st Generation: Hierarchical structure: smaller components
come together as parts of larger components
Magnetic tapes, serial storage devices
Network DBMS – Mid 1960s
2nd generation: Relational DBMS
3rd Generation: Object-Relational DBMS
58 / 66
Advantages of DBMSs
Control of data redundancy
◦ By integrating the files so that multiple copies of the same
data are not stored
Data consistency
◦ Any update to its value has to be performed only once and
the new value is available immediately to all users
◦ If a data item is stored purposely more than once, the
system can ensure that all copies of the item are kept
consistent (not all DBMS do this)
59 / 66
Advantages of DBMSs
More information from the same amount of data
◦ With the integration of the operational data, it is possible
to derive additional information from the same data
Sharing of data
◦ Files are owned by departments but can be shared by all
60 / 66
Advantages of DBMSs
Improved security
◦ DBA will define the security and the DBMS to enforce
Enforcement of standards
◦ Whether organizational standards or international
Economy of scale
◦ Cost saving due to centralization
61 / 66
Advantages of DBMSs
Balance conflicting requirements
◦ The DBA will control the conflicting requirements
Increased productivity
◦ Ready made functions and standards
62 / 66
Advantages of DBMSs
Improved maintenance through data independence
◦ Data-independence: DBMS separates the data descriptions
from the applications
◦ Applications are prevented from changes
Increased concurrency
◦ Managing concurrent DB access
Size
◦ Complexity and functionality makes it a large software
Cost of DBMS
◦ Personal DB ≈ $100
◦ Multiuser DBMS ≈ $100k – $1 million
64 / 66
Disadvantages of DBMSs
Additional hardware costs
◦ Because of the large disk space requirement
Cost of conversion
◦ Cost of converting existing applications to work on new
DBMS
◦ Cost of training staff to use new systems
◦ Cost of employment of new specialist
◦ That is why some organizations are tied to their current
systems and can’t switch to more modern DB technology
65 / 66
Disadvantages of DBMSs
Performance
◦ DBMS is more general to cater for many applications
the application may not run as fast as they used to.
66 / 66