DBMS Module1
DBMS Module1
DBMS Module1
MANAGEMENT
SYSTEM-
module 1
PRESENTED BY
-MRS. POONAM MISHRA
Introduction to
Databases and
transactions
What is database system?
A database-management system (DBMS) is a
collection of interrelated data and a set of programs to
access those data.
The collection of data, usually referred to as the
database, contains information relevant to an
enterprise. The primary goal of a DBMS is to provide a
way to store and retrieve database information that is
both convenient and efficient.
Manage large bodies of information.
The database system must ensure the safety of the
Information stored, despite system crashes or attempts
at unauthorized access
Purpose of database system
• Data redundancy and inconsistency.-
Files and application programs created by different
programmers have Different structures and written using
different programming languages.
The same information may be duplicated in several places (files).
This redundancy leads to higher storage and access cost.
In addition, it may lead to data inconsistency; that is, the various
copies of the same data may no longer agree.
? For example, a changed student address may be reflected in the
one department records but not elsewhere in the system.
Difficulty in accessing data:
? Suppose that one of the university clerks needs to find out
the names of all students who live within a particular
postal-code area.
? The clerk asks the data-processing department to generate
such a list.
? Because the designers of the original system did not
anticipate this request, there is no application program on
hand to meet it.
? There is, however, an application program to generate the
list of all students.
? The university clerk has now two choices: either obtain the
list of all students and extract the needed information
manually or ask a programmer to write the necessary
application program.
? Both alternatives are obviously unsatisfactory.
? Suppose that such a program is written, and that, several
days later, the same clerk needs to trim that list to include
only those students who have taken at least 60 credit hours.
? As expected, a program to generate such a list does not exist.
Again, the clerk has the preceding two options, neither of
which is satisfactory.
? The point here is that conventional file-processing
environments do not allow needed data to be retrieved in a
convenient and efficient manner.
? More responsive data-retrieval systems are required for
general use.
• Data isolation-
? Because data are scattered in various files, and files may be in
different formats, writing new application programs to retrieve the
appropriate data is difficult.
• Integrity problems-
? The data values stored in the database must satisfy certain types of
consistency constraints.
? Suppose the university maintains an account for each department,
and records the balance amount in each account.
? Suppose also that the university requires that the account balance of
a department may never fall below zero.
? Developers enforce these constraints in the system by adding
appropriate code in the various application programs.
? However, when new constraints are added, it is difficult to change
the programs to enforce them. The problem is compounded when
constraints involve several data items from different files.
• Atomicity problems-
? A computer system, like any other device, is subject to failure.
? In many applications, it is crucial that, if a failure occurs, the data
be restored to the consistent state that existed prior to the failure.
? Example: Consider a program to transfer Rs 500 from the account
balance of department A to the account balance of department B.
? If a system failure occurs during the execution of the program, it is
possible that the 500 Rs was removed from the balance of
department A but was not credited to the balance of department B,
resulting in an inconsistent database state.
? Clearly, it is essential to database consistency that either both the
credit and debit occur, or that neither occur. That is, the funds
transfer must be atomic—it must happen in its entirety or not at all.
It is difficult to ensure atomicity in a conventional file-processing
system.
• Concurrent-access anomalies-
? For the sake of overall performance of the system and
faster response, many systems allow multiple users to
update the data simultaneously.
? Indeed, today, the largest Internet retailers may have
millions of accesses per day to their data by shoppers.
? In such an environment, interaction of concurrent updates
is possible and may result in inconsistent data.
• Security problems-
? Not every user of the database system should be able to
access all the data.
? For example, in a university, payroll personnel need to see
only that part of the database that has financial
information.
? They do not need access to information about academic
records.
? But, since application programs are added to the
file-processing system in an ad hoc manner, enforcing such
security constraints is difficult.
? These difficulties, among others, prompted the
development of database systems.
View of Data
? A database system is a collection of interrelated data and a
set of programs that allow users to access and modify these
data.
? A major purpose of a database system is to provide users
with an abstract view of the data. That is, the system hides
certain details of how the data are stored and maintained.
1.Data Abstraction-
? As many database-system users are not computer trained,
developers hide the complexity from users through several
levels of abstraction, to simplify users interactions with the
system:
? Physical level-The lowest level of data abstraction which
describes how the data is actually stored.
? Logical level- The next-higher level of abstraction that
describes what data are stored in the database, and what
relationships exist among those data.
? The logical level thus describes the entire database in terms
of a small number of relatively simple structures.
? The logical level of abstraction is used by the Database
administrators, who must decide what information is to be
kept in the database.
? View level- This is the highest level of data abstraction which
describes only the part of the entire database.
? Many users of the database system do not need all the
information; instead, they need to access only a part of the
database.
? Even though the logical level uses simpler structures,
complexity remains because of the variety of information
stored in a large database.
? The view level of abstraction exists to simplify their
interaction with the system. The system may provide many
views for the same database. The views also provides a
security mechanisms to prevent some users from accessing
parts of the database.
? For example- clerks in the university registrar office can see
only that part of the database that has information about
students; they cannot access information about salaries of
instructors.
2.Instances and Schemas
? Databases change over time as information is inserted and
deleted.
? Instance - The collection of information stored in the
database at a particular moment is called an instance of
the database.
? Schema - The overall design of the database is called the
database schema.
other entity.
1. Hierarchical Model
? In Hierarchical Model, a hierarchical relation is formed
by collection of relations and forms a tree-like
structure.
? The relationship can be defined in the form of parent
child type.
? One of the first and most popular Hierarchical Model
is Information Management System (IMS), developed
by IBM.
Advantages
● The design of the hierarchical model is simple.
● Provides Data Integrity since it is based on parent/ child
relationship
● Data sharing is feasible since the data is stored in a
single database.
● Even for large volumes of data, this model works
perfectly.
Disadvantages
● Implementation is complex.
● This model has to deal with anomalies like Insert,
Update and Delete.
● Maintenance is difficult since changes done in the
database may want you to do changes in the entire
database structure.
2. Network Model
· The Hierarchical Model creates
hierarchical tree with parent/ child
relationship, whereas the Network Model
has graph and links.
· The relationship can be defined in the
form of links and it handles many-to-many
relations. This itself states that a record
can have more than one parent.
Advantages
● Easy to design the Network Model
● The model can handle one-one, one-to-many,
many-to-many relationships.
● It isolates the program from other details.
● Based on standards and conventions.
Disadvantages
● Pointers bring complexity since the records are
based on pointers and graphs.
● Changes in the database isn’t easy that makes it
hard to achieve structural independence.
3. Relational Model
? A relational model groups data into
one or more tables. These tables are
related to each other using common
records.
? The data is represented in the form of
rows and columns i.e. tables:
Advantages
● The Relational Model does not have any issues that we
saw in the previous two models i.e. update, insert and
delete anomalies have nothing to do in this model.
● Changes in the database do not require you to affect the
complete database.
● Implementation of a Relational Model is easy.
● To maintain a Relational Model is not a tiresome task.
Disadvantages
● Database inefficiencies hide and arise when the model has
large volumes of data.
● The overheads of using relational data model come with
the cost of using powerful hardware and devices.
4. E-R model
? An E-R model is the logical
representation of data as objects
and relationship among them.
? This objects are known as Entities
and relationship is an association
between these entities.
Advantages
1. Database Design
a
❖ One is to one:
A single record in one table is related to a single record in
another table.
E.g., One department can have only one manager, Each
person has one passport, and each passport is assigned to
one person.
❖ One is to Many:
A single record in one table can be related to multiple
records in another table.
E.g., One department may have many employees, but each
employee belongs to only one department.
❖ Many is to one:
Multiple records in one table are related to a single
record in another table.
E.g., Many students may be assigned to one professor,
but each student has only one professor.
❖ Many is to Many:
Multiple records in one table are related to multiple
records in another table.
E.g., Students can enroll in multiple courses, and each
course can have multiple students enrolled.
1.Participation Constraints:
· The foreign key may be null and may have the same
value but, the foreign key value must match a record
in the table it is referring to.