BS (COMPUTER SCIENCE) PROGRAM
BS (SOFTWARE ENGINEERING)
PROGRAM
Database Systems (DBS)
STAFF
Theory Instructor: Afzal Hussain
(MCS, MSE, CISA , ITIL, COBIT)
Senior Faculty Room (Ground Floor),
afzal.hussain@hamdard.edu.pk
Consultancy Hours: Refer to timetable in the Staff
Room
Lab Instructor: Mrs. Muntaha
TEXT BOOKS
Main textbook:
Database Systems: The Complete Book, Hector
Garcia-Molina, Jeffrey Ullman, Jennifer Widom
Almost identical:
A First Course in Database Systems, Jeff Ullman
and Jennifer Widom
Database Implementation, Hector Garcia-Molina,
Jeff Ullman and Jennifer Widom
OTHER BOOKS
DatabaseManagement Systems,
Ramakrishnan
very comprehensive
Fundamentals of Database Systems,
Elmasri, Navathe
very widely used
Foundations of Databases, Abiteboul, Hull,
Vianu
Mostly theory of databases
COURSE ASSESSMENTS
Final Exam = 50
Midterm Exam = 30
Quiz = 10
Assignment = 10
Tutorials and Class based Work (For Improved
Grade)
WHAT YOU NEED TO DO
Attend the lectures! (ALSs)
Ask any question you like during the
lectures (or during my office hours)
Don’t be scared to ask questions or
contribute with your comments
Work harmoniously for the group
project
Pass this course with a good grade!
LESSON 1
DATABASE ENVIRONMENT
LESSON OBJECTIVES
Understand and define basic terminologies associated with
database (file, record, field, primary key, relationship)
Define the differences (by giving examples): Data and information
Know the difference between a file processing approach and a
database approach;
Know the disadvantages of file processing / manual system
Databases advantages and disadvantages
Identify and explain the components of database environment.
Database designer and database administrator
Database Development Life Cycle (DDLC)
BASIC TERMINOLOGIES
Data are facts - people, objects or events.
Information- processed and presented in a
form suitable for human interpretation, often
with the purpose of revealing trends or
patterns.
Process
involves acquisition, storage,
manipulation, retrieval and distribution.
DATA VS. INFORMATION
Data – a collection of facts made up of text,
numbers and dates:
Kiki 35000 7/18/86
Information - the meaning given to data in the
way it is interpreted:
Mr. Kiki is a sales person whose annual salary is $35,000 and
whose hire date is July 18, 1986.
WHAT IS THE ULTIMATE PURPOSE OF A
DATABASE MANAGEMENT SYSTEM?
Is to transform
Data Information Knowledge Action
Data driven decision making
WHAT IS A DATABASE?
A structured collection of related data
An filing cabinet, an address book, a
telephone directory, a timetable, etc.
Google and your email is a database
School Student Information System
WHAT IS A DATABASE?
DATABASE
A database is a share
FILES
collection of logically
related data, designed
record 1
to
record 2
record 3
record 4
DATA meet the information
:::::::
needs of multiple users
in an organization.
EXAMPLES OF DATABASE
APPLICATIONS
Purchases from the supermarket (http://www.tesco.com/)
Purchases using your credit card (http://www.amazon.com)
Booking a holiday at the travel agents
(http://www.expedia.com)
Buying ticket (http://www.airasia.com)
Using the local library (http://www.psz.utm.my)
Property management (http://www.rightmove.co.uk)
Banking transaction (http://www.maybank2u.com.my)
TYPES OF DATABASES
Single-user:
Supports only one user at a time
Desktop:
Single-user database running on a personal computer
Multi-user:
Supports multiple users at the same time
BCO
MP1
203
TYPES OF DATABASES
Workgroup:
15
Multi-user database that supports a small group of
DATABASE SYSTEMS
users or a single department
Enterprise:
Multi-user database that supports a large group of
users or an entire organization
BCO
MP1
203
TYPES OF DATABASES (CONTINUED)
Can be classified by location:
16
Centralized:
DATABASE SYSTEMS
Supports data located at a single site
Distributed:
Supports data distributed across several sites
BCO
MP1
203
TYPES OF DATABASES (CONTINUED)
Can be classified by use:
17
Transactional (or production):
DATABASE SYSTEMS
Supports a company’s day-to-day operations
Data warehouse:
Stores data used to generate information required to
make tactical or strategic decisions
Often used to store historical data
Structure is quite different
BCO
MP1
203
WHY DATABASE DESIGN IS
IMPORTANT
Defines the database’s expected use
18
Different approach needed for different types of
DATABASE SYSTEMS
databases
Avoid redundant data
Poorly designed database generates errors leads
to bad decisions can lead to failure of
organization
BCO
MP1
203
BASIC DATABASE CONCEPTS
Table Name: Kiki Lala
– A set of related records College: KIGS
Tel: 2238701
Record
– A collection of data Name: Kiki Lala
College: KIGS
about an individual item Tel: 2238701
Field
Name: Kiki Lala
– A single item of data
common to all records
AN EXAMPLE OF A TABLE
Fields
Records
Student ID FirstName LastName Course
44-0986 Edmond Kevinsean HNDC
12-2365 Cyril Minjohn HNDBM
11-1234 Cynthia Dominic PNDCS
PRIMARY KEYS & FOREIGN
KEYS
Student ID FirstName LastName Course
44-0986 Edmond Kevinsean HNDC
12-2365 Cyril Minjohn HNDBM
11-1234 Cynthia Dominic PNDCS
To ensure that each record is unique in each table, we can
set one field to be a Primary Key field.
A Primary Key is a field that that will contain no duplicates
and no blank values.
Foreign Keys link to data in other tables
WHAT IS A RELATIONAL DATABASE
MANAGEMENT SYSTEM (RDMS)?
A relational database is a collection of tables from
which data can be accessed in many different
ways without having to reorganize the database
tables.
DON’T DUPLICATE DATA
That is, once relationships are created, tables can “talk”
to each other. We can link (relate) the tables to find:
Which students taking what courses?
Which students are in which subjects?
Which subjects are under the programme?
Relationships
DATABASE OPTIONS
Consumer Enterprise RDMS
Flat Files Oracle
Microsoft Excel IBM/DB2
- Limit of 65,536 Rows MS SQL-server
Microsoft Access Sybase
FileMaker Pro Informix
MySQL (Open Source) Lotus Notes
Postgres (Open Source) MySQL (Open Source)
Postgres (Open Source)
INPUT DATA WITH FORMS
A friendlier view of the database
Used for data input, menus, display and printing
Can perform Calculations and Combine fields
DATABASES AND THE WEB
Accessing databases through web forms
Java programming interface (JDBC)
Embedding into HTML pages (JSP or ASP)
Access through http protocol (Web Services)
Using Web document formats for data definition
and manipulation
XML, XML databases and messaging systems
QUERIES
A means of asking questions (querying) of your data
Can look across a number of Tables and other Queries
Can perform Calculations and Combine fields
SQL
Structured Query Language (SQL) is used for relational
database “programming.”
it is alleged that SQL is the most commonly used
programming language in the world
SQL is essentially divided into two sublanguages
Data Manipulation Language (DML)
Data Definition Language (DDL)
SELECT "column_name" FROM "table_name"
SELECT
SELECT F2Q2B, Count(*) AS TOTAL FROM FORM2 GROUP BY F2Q2B
select F2Q3, F2Q3T from form2 ORDER BY F2Q3
INTRODUCING REPORTS
Output of information in a printed report
Allows you to group and summarize data
Can perform calculations and combine fields
Cannot Edit Data
Can Make Labels
DESIGN OF DATABASE:
CENTRALIZED DATABASE
All data are located at a single site.
Advantage - provide greater control over
accessing and updating data.
Disadvantage - vulnerable to failure
Examples:Personal Computer Database,
Central Computer Database, Client/Server
Databases
DESIGN OF DATABASE: DISTRIBUTED
DATABASE
A single logical database - spread physically
across computers in multiple locations.
Can be Homogeneous or Heterogeneous
Homogeneous:
OS used at each location same or highly compatible.
The data models used at each location are the same.
The DBMS used at each location are the same or highly
compatible.
The data at the various locations have common
definitions and formats.
Heterogenous
Different computers, OS, data models, DBMS may be
possible
2 APPROACHES IN
KEEPING DATA
1. Traditional file processing
2. Database
FILE PROCESSING
APPROACH
A traditional approach to information
system design.
Focuses on the data processing
needs of individual departments in
the organization.
Example: KIGS office, Library
FILE PROCESSING
APPROACH
Disadvantages
Uncontrolled Redundancy
Inconsistent Data
Inflexibility
Limited Data Sharing
Poor Enforcement of Standards
Excessive Program Maintenance
DATABASE APPROACH
Benefits Costs
Minimal Data New, Specialized
Redundancy Personnel
Consistency of Data Need for Explicit Backup
Integration of Data Interference with Shared
Sharing of Data Data
Ease of Application Organizational Conflict
Development
Components of the Database Environment
Data System End
administrators developers users
User Application
interface programs
Repository DBMS Database
DATA & DATABASE ADMINISTRATION
Sometimes, data are not fully utilized. Why?
Multiple definition – making linking different
Missing key data elements – existing data useless
Not knowing
What data to exist?
Where to find them?
What they really mean?
DATA & DATABASE ADMINISTRATION
What is a data administration?
High level function
Overall management of data resources in an
organization
Maintaining corporate-wide definitions and
standards
What is a database administration?
Technicalfunction
Responsible for:
physical database design
security enforcement (user and password)
database performance
backup and recovery
THE
DUTIES
Authorizing access to the database
Database
Coordinating and monitoring its
Designer
use
Acquiring software and hardware
Accountable for problems
security breach
poor response time
Identify data to be stored
Choosing appropriate structures to
represent and store this data
Database Communicate to database users
Administrato Understand requirements
r Develop designs that meet
requirements
TWO APPROACHES TO DATABASE
DEVELOPMENT
SDLC
System Development Life Cycle
Detailed, well-planned development process
40
Time-consuming, but comprehensive
Long development cycle
Prototyping
Rapid application development (RAD)
Cursory attempt at conceptual data modeling.
Define database during development of initial
prototype
Repeat implementation and maintenance activities
with new prototype versions
SDLC
SYSTEMS DEVELOPMENT LIFE CYCLE
Project Identification
and Selection
Project Initiation
and Planning
Analysis
Logical Design
Physical Design
Implementation
Maintenance
SYSTEMS DEVELOPMENT LIFE CYCLE
(CONT.)
Project
Project Identification
Identification
and
and Selection
Selection Purpose --preliminary understanding
43
Deliverable –request for project
Project Initiation
and Planning
Analysis
Logical Design
Physical Design
Database activity –
Implementation
enterprise modeling
Maintenance
SYSTEMS DEVELOPMENT LIFE CYCLE
(CONT.)
Project Identification
and Selection Purpose – state business situation and solution
44
Deliverable – request for analysis
Project
Project Initiation
Initiation
and
and Planning
Planning
Analysis
Logical Design
Physical Design
Database activity –
Implementation
conceptual data modeling
Maintenance
SYSTEMS DEVELOPMENT LIFE CYCLE
(CONT.)
Project Identification
and Selection Purpose – thorough analysis
45
Project Initiation
Deliverable – functional system specifications
and Planning
Analysis
Analysis
Logical Design
Physical Design
Database activity –
Implementation
conceptual data modeling
Maintenance
SYSTEMS DEVELOPMENT LIFE CYCLE
(CONT.)
Project Identification
and Selection
Purpose – information requirements structure
Deliverable – detailed design specifications
46
Project Initiation
and Planning
Analysis
Logical
Logical Design
Design
Physical Design
Database activity –
Implementation
logical database design
Maintenance
SYSTEMS DEVELOPMENT LIFE CYCLE
(CONT.)
Project Identification Purpose – develop technology specs
and Selection
Deliverable – program/data
47
Project Initiation structures, technology purchases,
and Planning
organization redesigns
Analysis
Logical Design
Physical
Physical Design
Design
Database activity –
Implementation
physical database design
Maintenance
SYSTEMS DEVELOPMENT LIFE CYCLE
(CONT.)
Project Identification Purpose – programming, testing, training,
and Selection installation, documenting
48
Project Initiation Deliverable – operational programs,
and Planning documentation, training materials
Analysis
Logical Design
Physical Design
Database activity –
Implementation
Implementation
database implementation
Maintenance
SYSTEMS DEVELOPMENT LIFE CYCLE
(CONT.)
Project Identification
and Selection Purpose – monitor, repair, enhance
49
Deliverable – periodic audits
Project Initiation
and Planning
Analysis
Logical Design
Physical Design
Database activity –
Implementation
database maintenance
Maintenance
Maintenance
Prototyping
The prototyping methodology and database development process
51
The prototyping methodology and database development process
52
The prototyping methodology and database development process
53
The prototyping methodology and database development process
54
The prototyping methodology and database development process
55