Beruflich Dokumente
Kultur Dokumente
SYSTEM
(DBMS)
DBMS
Two methods are used for organizing
data:
File-oriented approach
Database-oriented approach
File-oriented approach
Traditional method of organizing
data.
Application data are organized into
one or more files and the application
program processes data stored in
these files to generate output.
Limitations of file-oriented
approach
Data Redundancy & Inconsistency
Difficulty in accessing data
Data Isolation
Integrity Problems
Atomicity Problem
Concurrent-access anomalies
Security Problems
MBA-12 Batch (2015-17)
Data Isolation
Data are scattered in various files
and files may be in different formats.
So that to write new application
program to retrieve the appropriate
data is difficult.
Integrity Problems
The data values stored in the database must
satisfy
certain
types
of
consistency
constraints.
Ex. The balance of customer account may
never fall below a minimum amount. So the
application programmer must enforce certain
constraints in the system by adding appropriate
code in various application programs. When
new constraints are added, it is difficult to
change the programs to enforce them. Then the
problem is compounded when constraints
involve several data items from different files.
MBA-12 Batch (2015-17)
Atomicity Problem
It is crucial to ensure that once a
failure has been detected, data are
restored to the consistent state that
existed prior to the failure.
Concurrent-access anomalies
Multiple users can not update data
simultaneously
leads
data
inconsistency.
Security Problems
Every user of the system can not able to
access all data.
Ex. In a banking system, the payroll
personnel can see only the part of the
system that has information about various
bank employees. But they do not access
information about customer accounts. Since
application programs are added to the
system in an ad hoc manner, it is difficult to
enforce such security constraints.
MBA-12 Batch (2015-17)
Database-oriented approach
Database Management (DBMS) consists of
interrelated data and a set of programs to
retrieve/ access those data.
The collection of data is called as
database which contains information
relevant to an enterprise.
Purpose of DBMS
To provide an environment that is both
convenient and efficient to use in retrieving
and storing database information.
The management of data involves the definition
of structures for data storage and the provision
for the manipulation of data.
It also ensures system security which prevents
data loss due to system failure and unauthorized
access.
MBA-12 Batch (2015-17)
Components of DBMS
Four major components. Such are:
1) Data: Data stored in a system is partitioned
into one or more databases.
- Database can be either integrated or shared.
An integrated db is a collection of related
tables/relations.
A shared db is the data in a table can be used
by other tables in the db.
MBA-12 Batch (2015-17)
Contd
2)
Hardware:
This
consists
of
secondary storage devices (i.e. disks and
drums) where the db resides. Other
associated devices and control unit also
forms a part of the hardware.
Contd
3) Software: Between the physical db, where
the data actually stored and the users there is a
layer, called DBMS.
All requests from users for accessing the db are
handled by DBMS. The requests include adding
and removing, retrieving and updating data in
tables. Here DBMS serves as an interface
between the users and the hardware.
MBA-12 Batch (2015-17)
Contd
4) Users: Users are classified into 3 groups.
a) Application Programmers: responsible
for writing application programs. The
application
programs
are
written
in
languages such as COBOL, C, Pascal etc.
These programs retrieve existing information,
insert new information and delete or update
existing information in the db.
b) End Users: responsible for interacting
with DBMS through computer terminals.
For example: End users use SQL for
interacting with DBMS.
MBA-12 Batch (2015-17)
Applications of DBMS
Banking for customer information, accounts, loans and various
banking
transaction.
Airlines for reservation and schedule information.
Universities for student information and registration.
Credit card Transaction for purchases on credit cards.
Telecommunication for keeping records of calls made, generation
of monthly bills, maintaining balances on prepaid calling SIM
cards.
Finance for storing information about sales purchases, etc.
Human Resource Management for information about employees,
salaries and other benefits and fetch information for generating
cheques.
MBA-12 Batch (2015-17)
Characteristics of DBMS
A db provides fast and easy access to data.
Data Integrity: is the ability to correctly and
consistently navigate and manipulate tables in a
db.
Data Independence: refers to the storage of data
in such a way that it is not affected by modification
in data structure or changes in the application
program. Data Independence are of two types:
Physical Data Independence
Logical Data Independence
MBA-12 Batch (2015-17)
Contd
Prevent Data Redundancy and Inconsistency
Sharing of data: Different users should be able to
access the data from the db at the same time.
Data Security: To ensure safety, data stored in
databases should be made accessible only to
authorized users. Regular back up procedure is
required to minimize data loss due to system
failure.
Contd
-
Regulate
Standards:
In
most
organizations, databases are centralized,
i.e. all data stored in a central location.
DBAs regulate the standards for accessing
databases.
Disadvantages of DBMS
Increased
becomes
Complexity:
extremely
complex
multi
user
DBMS
software
due
to
its
developers,
DBAs
and
end-users
to
Contd
Increased installation and
management costs
Need for explicit backup and recovery
Levels of Abstraction/Views of
data in the database
The major purpose of DBMS is to
provide users with an abstract view
of data. So the system hides certain
details of how the data are being
stored and maintained inside the
DBMS.
Basically there are 3 levels of
abstraction. Such are:
MBA-12 Batch (2015-17)
View Level
View1
View2
View3
View n
Logical Level
Physical Level
Data Independence
The ability to modify a schema
definition in one level without
affecting a schema definition in the
next higher level is called data
independence.
Data Models
A model is an abstraction process that
concentrates (highlights) on essential and
inherent aspects of the organizational
applications
and
ignores
(hides)
superfluous/accidental details.
A model is a representation of real-world
objects or events & their associations.
A data model (also called as Database
Model) is a mechanism which provides
abstraction for the database applications.
MBA-12 Batch (2015-17)
Relational Model:
The
Relational
model
uses
a
collection of tables to represent both
data and the relationships among
those data. Each table has multiple
columns and each column has a
unique name.
Network Model:
Data in the network model are
represented by collection of records
and relationships among data are
represented by links, which can be
viewed as pointers. The records in
the database are organized as
collections of arbitrary graphs.
Hierarchical Model:
The hierarchical model is similar to
the network model in the sense that
data and relationships among data
are represented by records and links
respectively. It differs from network
model in that the records are
organized as collections of trees
rather than arbitrary graphs.
Object-Oriented Model:
Object-Oriented
model
is
based
on
collection of objects. An object contains
values stored in instance variables within
the object. An object also contains codes
(also called as Method) that operate on the
object. Objects those contain same types of
values and same methods are grouped
together into classes. A class may be
viewed as a type definition for objects. One
object can access the data of another object
is by invoking method of other object and
this action is called as message passing.
MBA-12 Batch (2015-17)
Object-Relational Model:
The Object-Oriented models are
converted into relations and named
as Object-relational models.
E-R Modeling
A database can be modeled as:
a collection of entities,
relationship among entities.
Loan_
no
Amount
Relationship Sets
A relationship is an association among several
entities
Example:
Hayes
depositor
A-102
customer entity relationship set account entity
A relationship set is a relationships of the same
type and a mathematical relation among n 2
entities, each taken from entity sets
{(e1, e2, en) | e1 E1, e2 E2, , en En}
where (e1, e2, , en) is a relationship
Example:
(Hayes, A -102) depositor
MBA-12 Batch (2015-17)
Attributes
An entity is represented by a set of attributes, that is descriptive
properties possessed by all members of an entity set.
Example:
customer = (customer_id, customer_name, customer_street,
customer_city )
loan = (loan_number, amount )
Domain the set of permitted values for each attribute.
Attribute types:
Simple and composite attributes.
Single-valued and multi-valued attributes
Composite Attributes
Constraints
(A) Mapping Cardinality
Constraints
One to one
One to many
Many to one
Many to many
MBA-12 Batch (2015-17)
Mapping Cardinalities
One to one
One to many
Mapping Cardinalities
Many to Many
Many to One
Note: Some elements in A and B may not be mapped to any
MBA-12 Batch (2015-17)
elements in the other set
Mapping Cardinalities
For a binary relationship set the
mapping cardinality must be one of
the following types:
One to one
One to many
Many to many
(B) Keys
Key is used to uniquely identify a
record.
Keys allow us to identify a set of
attributes that suffice to distinguish
entities from each other.
Keys are also help to uniquely
identify relationships.
MBA-12 Batch (2015-17)
Keys (contd.)
A super key of an entity set is a set of one or more attributes
whose values uniquely determine each entity.
Ex. Customer_id attribute of Customer entity set is sufficient to
distinguish one Customer entity from another. Thus
Customer_id is a super key for the entity Customer.
Similarly, the combination of Customer_id & Customer_name is
a super key for the entity Customer. But the Customer_name
attribute can not be a super key because many customers may
have same name.
A candidate key of an entity set is a minimal super key.
Candidate keys are proper subset of super keys.
E-R Diagrams
Integrity Constraints
Constraints are the rules or conditions which can be defined on the
specified column in order to prevent the entry of invalid data.
Integrity Constraints ensure that changes made to the database
by authorized users do not result in a loss of data consistency.
Therefore integrity constraints guard against accidental damage to
the
database.
Some preliminary examples of integrity constraints are:
- An account balance cannot be null.
- No two accounts can have the same account number.
Contd
not null: It does not support null values in
specified column.
Ex: ename varchar(20) not null
check: The check clause is used to ensure that
attribute values satisfy specific condition for the
whole tuples present in the relation.
Ex: create table branch
(branch_name varchar2(15),
branch_city varchar2(30),
assets numeric(16,2),
check (assets>=0)));
unique: It does not allow duplicate values in
specified column and it allows single null value.
MBA-12 Batch (2015-17)
Contd
Primary key: This is same as the
unique constraint which is used to
prevent duplicate values and also it
does not support null values.
Ex: create table customer
(customer_id integer,
customer_name char(20),
customer_city char(30),
primary key (customer_id));
MBA-12 Batch (2015-17)
Contd
Foreign key: This constraint is used for establishing the
relation between two tables and that relation is called as
parent-child relation. The foreign key constraint is
defined in the child table and is associated with the
primary key or unique key attribute of the parent table.