Lect 1
Lect 1
INTRODUCTION TO
DATABASE
1
What is data? A Historical perspective
• A collection of facts from which conclusion
may be drawn.
• Data is often obtained as a result of recordings
or observations.
• Data is the plural form of datum.
• The temperature of the days is data.
2
Temperature of the days
• When this data is to be collected, a system or
person monitors the daily temperatures and
records it.
• Finally when it is to be converted into
meaningful information, the patterns in the
temperatures are analyzed and a conclusion
about the temperature is arrived at.
• So information obtained is a result of analysis,
communication, or investigation.
3
Properties of Data
• Data should be well organized.
• Data should be related.
• Data should be accessible in any order.
• One data should be stored minimum number
of times.
4
What is a Database?
Database is a collection of related data, that
contains information relevant to an
enterprise.
For example:
1. University database
2. Employee database
3. Student database
4. Airlines database
5
PROPERTIES OF A DATABASE
• A database represents some aspect of the real
world, sometimes called the miniworld or the
universe of discourse (UoD).
• A database is a logically coherent collection of
data with some inherent meaning.
• A database is designed, built and populated
with data for a specific purpose.
6
What is Database Management
System (DBMS)?
• A database management system (DBMS) is a collection of
programs that enables users to create & maintain a
database. It facilitates the definition, creation and
manipulation of the database.
• Definition – it holds only structure of database, not the
data. It involves specifying the data types, structures &
constraints for the data to be stored in the database.
• Creation –it is the inputting of actual data in the database.
It involves storing the data itself on some storage medium
that is controlled by the DBMS.
• Manipulation-it includes functions such as updation,
insertion, deletion, retrieval of specific data and generating
reports from the data.
7
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
8
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
9
Database System
• The database and the DBMS together is called the
database system.
• Database systems are designed to manage large bodies
of information.
• It involves both defining structures for storage of
information & providing mechanisms for the
manipulation of information.
• Database system must ensure the safety of the
information stored.
• Meta data- it is the data about the data. It contains the
structure of the database as well as the physical
location of the database.
10
A simplified database system
environment
11
Database System Applications
• Banking- for customer information, accounts & loans, and banking
transactions.
• Airlines-for reservations & schedule information.
• Universities-for student information, course registration and
grades.
• Credit card transactions-for purchases on credit cards & generation
of monthly statements.
• Telecommunication-for keeping records of calls made, generating
monthly bills, maintaining balances, information about
communication networks.
• Finance-for storing information about holdings, sales & purchases
of financial instruments such as stocks & bonds.
• Sales-for customer, product and purchase information.
• Manufacturing-for management of supply chain & for tracking
production of items in factories.
• Human resources-for information about employees, salaries,
payroll taxes and benefits
12
Database system
• Oracle
• SQL Server
• DB2
• Sybase
• MySQL
• PostgreSQL
• Teradata
• Informix
• Ingres
• Amazon’s SimpleDB
13
Traditional File systems
• Before the evolution of DBMS, organizations
used to store information in file systems.
• The system stores permanent records in
various files & it need application program to
extract records , or to add or delete records .
• In traditional file processing, each user defines
and implements the files needed for a specific
application.
1
Traditional file system
• For example, one user, the grade reporting office, may keep a
file on students and their grades. Programs to print a student’s
transcript and to enter new grades into the file are
implemented.
• A second user, the accounting office, may keep track of
students’ fees and their payments.
• Although both users are interested in data about students, each
user maintains separate files—and programs to manipulate
these files—because each requires some data not available
from the other user’s files.
• This redundancy in defining and storing data results in wasted
storage space and in redundant efforts to maintain common
data up-to-date.
2
Disadvantages of File systems
1.Data Redundancy & Inconsistency
2.Difficulty in Accessing data
3.Data Isolation
4.Integrity Problems
5.Atomicity Problems
6.Concurrent access Anomalies or Problems
7.Security Problems
3
Data Redundancy & Inconsistency
• Different programmers work on a single project , so various files are
created by different programmers at some interval of time.
• So various files are created in different formats & different
programs are written in different programming language.
• Same information is repeated.
• For example: name & address may appear in saving account file as
well as in salary account.
• This redundancy results in higher storage space & access cost.
• It also leads to data inconsistency which means that if we change
some record in one place the change will not be reflected in all the
places.
• For ex. a changed customer address may be reflected in saving
record but not any where else.
4
Difficulty in Accessing data
• Accessing data from a list is also a difficulty in file
system.
• Suppose we want to see the records of all customers
who has a balance less than Rs10,000, we can either
check the list & find the names manually or write an
application program.
• If we write an application program & at some later
time, we need to see the records of customer who
have a balance of less than Rs 20,000, then again a new
program has to be written.
• It means that file processing system do not allow data
to be accessed in a convenient manner.
5
Data Isolation
• As the data is stored in various files, & various
files may be stored in different format, writing
application program to retrieve the data is
difficult.
6
Integrity Problems
• We need that data stored should satisfy
certain constraints as in a bank a minimum
deposit should be of 1000 Rs.
• Developers enforce these constraints by
writing appropriate programs but if later on
some new constraint has to be added then it
is difficult to change the programs to enforce
them.
7
Atomicity Problems
• Any mechanical or electrical device is subject to failure, and
so is the computer system.
• In this case we have to ensure that data should be restored
to a consistent state.
• For example an amount of Rs 50 has to be transferred from
Account A to Account B.
• Let the amount has been debited from account A but have
not been credited to Account B and in the mean time,
some failure occurred.
• So, it will lead to an inconsistent state.
• So, we have to adopt a mechanism which ensures that
either full transaction should be executed or no transaction
should be executed i.e. the fund transfer should be atomic.
8
Concurrent access Problems
• Many systems allows multiple users to update the
data simultaneously.
• It can also lead the data in an inconsistent state.
• Suppose a bank account contains a balance of Rs
500 & two customers want to withdraw Rs100 &
Rs 50 simultaneously.
• Both the transaction reads the old balance &
withdraw from that old balance which will result
in Rs 450 , Rs 400 which is incorrect.
9
Security Problems
• All the user of database should not be able to
access all the data.
• For example a payroll Personnel needs to
access only that part of data which has
information about various employees & are
not needed to access information about
customer accounts.
10
Advantages of DBMS
1. Controlling Redundancy
2. Restricting Unauthorized Access
3. Providing Storage Structures for Efficient Query
Processing
4. Permitting Inferencing and Actions using Rules
5. Providing Multiple User Interfaces
6. Representing Complex Relationship among Data
7. Enforcing Integrity Constraints
8. Providing Backup and Recovery
11
Question
12