DB-Lec1.pptx
DB-Lec1.pptx
1
Course Objectives
The key objectives of this course include:
1. List and explain the terminology of the
relational database model
2. Analyze business information requirements
using entity relationship diagrams (ERD)
3. Analyze a data model (ERD) into a logical
database design with normalized relations
4. Design, develop, test and prove the
functionality of a database
5. Construct, write and execute SQL queries
6. Explain the necessary steps to develop an
effective physical database design
2
Course Overview
● Introduction and significance of Databases
● Database Environment
● Database Languages
● Database Architectures and the web
● Relational model
● Database system development lifecycle
● Entity-relationship modelling
● Structural constraints
● Enhanced Entity-relationship modelling
● Normalization
● Functional dependencies
● SQL: Data Manipulation
● SQL Queries
● Ethical and security issues in database
3
Pre-requisites
● None
4
Recommended textbook
● Database Systems: A Practical Approach to Design,
Implementation, and Management, 6th Edition by
Thomas Connolly and Carolyn Begg
● Database Systems: The Complete Book, 2nd
Edition by Hector Garcia-Molina, Jeffrey D. Ullman,
Jennifer Widom
● Database System Concepts, 6th Edition by Avi
Silberschatz, Henry F. Korth and S. Sudarshan.
● Database Management Systems, 3rd Edition by
Raghu Ramakrishnan, Johannes Gehrkea, EMC
Education Services, John Wiley & Sons, 2015.
5
Grading criteria
Assessment %Age
Assignments/ Quizzes
18.75%
Viva/Sessional
25%
Mid Term Exam
22.5%
Final Term Exam 33.75%
Total
100%
6
Goals for today
● To introduce:
◦ Introduction to database
◦ Traditional file processing system
◦ Advantages/Disadvantages of database
7
Data
● A collection of raw facts and figures related to
an object
● Object may be a person, an organization, an
each student
● Students fee file used to store fee records of
students
● Students result file used to store the result of
examinations of students
● Students course file used to store data of
programs
● Still used in some small organizations
● Each department has its own set of data files
● Each application program is developed with its own
set of data files that is likely to be a subset of the
master file
Traditional file processing
environment
15
Disadvantages of File Processing
System
These subsets of the master file lead to
● Data redundancy
◦ Each application has its own data file so, same data may
have to be recorded and stored in many times.
● Data inconsistency
◦ Due to the same data items that appear in more than one
file do not get updated simultaneously in each and every
file.
● Data dependence
◦ Program and application in the file processing system are
data dependent but, the problem is incompatible with file
format. For example, suppose data about the customer bills
is stored in the file, and different programs use this file for
different purposes, like adding data into the bills file, to
compute the bill and to print the bill.
◦ Now the company asks to add the customers’ address in the
bills, for this we have to change the structure of the bill file
and also the program that prints the bill.
Disadvantages of File Processing
System
● Limited data sharing.
● The problem with security.
● Retrieval (retrieval is not easy).
● Time-consuming.
● Inefficient to maintain the record of the big firm
having a large number of items.
● Required Lots of labor work to do.
Database
● “Database is an organized collection of related
data stored in an efficient and compact manner”.
● "organized" means that data is stored in such a
way that it can easily be accessed and updated
● "related data“ means data and information
about a particular area is stored such as:
◦ Database of employees contains data of
employees of that particular organization or
department
◦ Database of students contains data of students
of a college/university etc.
● "efficient“ means required data can be searched
very easily and quickly
● "compact“ means that stored data takes up as
little space as possible without any duplication of
data
Examples of Databases
● NADRA
● Library
● College/University
● Bank Accounts
● E-mail Accounts
● Etc.
Types of databases
● Centralized databases
Database whose complete data is located at a single
computer such as Personal computer database,
client-server database and central computer
database.
● Distributed databases
A single logical database which is spread physically
across multiple computers over wide area network.
Such databases are managed by the organizations
having offices in different cities or countries.
20
Database Management System
(DBMS)
● A collection of programs that are used to create,
maintain, and extract data from databases
● It is general-purpose software
● This is often called database software
● Different types of DBMSs are available, ranging
from small systems that run on personal
computers to huge systems that run on
mainframes
Functions of DBMS
● Defining the Structure of Database
◦ It involves defining tables, fields and their data
types, constraints for data to be stored in the
database, and the relationships among tables.
● Populating the Database
◦ Means storing data into database
● Manipulating the Database
◦ In involves to retrieve specific data, update
data, delete data, insert new data, and generate
reports.
Examples of DBMS
● Microsoft Access
● Oracle
● Microsoft SQL Server
● MySQL
● FileMaker Pro
Components of a DBMS
Environment
Components of a DBMS
Environment
● Hardware
● This component of DBMS consists of a set of
roles in DBMS:
◦ Application Programmers
◦ Database Administrators
◦ End-Users
Different Users Role in DBMS
● Application Programmers
● The users who write the application programs
in programming languages (such as Java, C++,
or Visual Basic) to interact with databases are
called Application Programmer.
● Database Administrators (DBA)
● A person who manages the overall DBMS is
called a database administrator or simply DBA.
● End-Users
● The end-users are those who interact with the
database management system to perform
different operations by using the different
database commands such as insert, update,
retrieve, and delete on the data, etc.
Advantages of Database
● Controlling Data Redundancy
◦ In traditional file system, each application program
has its own data files and this result in duplication of
data in more than one places.
◦ Database approach reduces data redundancy.
◦ The data appears in a database appears only once and
it is not duplicated.
◦ Through controlling data redundancy storage space is
saved.
● Data Consistency
◦ By controlling data redundancy, data consistency in
obtained.
◦ Data item is appeared only once
◦ Any update in the value is performed only once and it
is readily available to everyone.
Advantages of Database
● Data Sharing
◦ Allows to share (access) data by any number of
users simultaneously.
● Data Integration
◦ In traditional file system, data is stored in
separate files and it is difficult to extract the
required information.
◦ In database, data is stored in tables.
◦ A single database may contain multiple tables.
◦ The relationships can be created between tables
.
◦ This makes easier to retrieve and update data.
Advantages of Database
● Data Integrity
◦ Data integrity refers to the correctness and consistency of
data.
◦ It is expressed in terms of certain constraints.
◦ The consistency rules are applied on database to check
that the correct data is entered in the database, before
storing.
● Data Atomicity
◦ Atomicity means that either one transaction should take
place as a whole or it should not take place at all.
◦ If the any process is not completed successfully then the
system fails and this is known as data atomicity problem.
◦ In database partially completed tasks are rolled back.
◦ Only consistent data exists within the database.
Advantages of Database
● Data Security
◦ It is the protection of the database from
unauthorized users.
◦ Only authorized persons are allowed to access
the database.
● Control Over Concurrency
◦ In some situations two or more users may access
the same file simultaneously.
◦ It is possible that they will interfere with each
other.
◦ For example, two or more users are trying to
update the same record, then one may overwrite
the values recorded by other user. This may
result in loss of information.
◦ Most databases control the concurrency so that
transactions are recorded with accuracy.
Advantages of Database
9. Better Backup and Recovery Facility:
35
Advantages of Database
● Data Independence
◦ The data stored in a database is
independent of the application programs
that accesses the data from database.
◦ The data structure of database and
application program that uses data are
separate from each other.
◦ The user can easily change the structure of
database without modifying the application
program.
◦ Similarly, user can modify application
programs without changing structure of
database.
Disadvantages of Database
1. High Cost:
Database includes the need for specialized
software which is used to run database systems,
Additional and specialized hardware and
technically qualified staff are the requirements
for adopting to the database system, all these
requirements need an organization to invest
handsome amount of money to have all the
requirements of the database systems.
37
Disadvantages of Database
2. Conversion Cost: Once an organization has
decided to adopt database system for its
operations, it is not only the finance and technical
man-power which is required for switching on to
database system, it further has some conversion
charges needed for adopting the database system,
this is also a very important stage for making
decision about the way the system will be
converted to database system.
38
Disadvantages of Database
3. Difficult Recovery Procedures: Although
the database systems and database
management systems provide very efficient
ways of data recovery in case of any disaster,
still the process of recovering a crashed
database is very much technical and needs
good professional skills to perform a perfect
recovery of the database.
39