DBMS Unit 1
DBMS Unit 1
Prepared By:
Ms. Barkha Namdev
What is Data?
Size
It occupies a large space of disks and large
memory to run them efficiently. The functionality of
DBMS makes use of a large piece of software
which occupies megabytes of disk space
Advantages of DBMS:
Minimized Data Inconsistency: Data inconsistency
occurs between files when different versions of the
same data appear in different places. For Example, data
inconsistency occurs when a student’s name is saved as
“John Wayne” on a main computer of the school but on
the teacher registered system same student name is
“William J. Wayne”,
Disadvantages of DBMS:
Complexity
The provision of the functionality that is expected
of a good DBMS makes the DBMS an extremely
complex piece of software. Database designers,
developers, database administrators and
end-users must understand this functionality to
take full advantage of it.
Failure to understand the system can lead to bad
design decisions, which leads to a serious
consequence for an organization.
Disadvantages of DBMS:
Reliability
A database management system is more
vulnerable to failure since the complete structure
is dependent on the database. Any damages to
the database could stop the functioning of all the
application programs. Even if one the component
starts malfunctioning, that will stop the entire
operations.
Disadvantages of DBMS:
Management
Once the user has implemented the database system,
the complications does not stop there. Whatever the
changes that occurs in the database system must be
managed accordingly. It requires proper management
from experienced staffs. The staffs should be well
aware of the location where the data needs to be located
and saved.
Applications of DBMS
Railway Reservation System − The railway reservation
system database plays a very important role by keeping
record of ticket booking, train’s departure time and
arrival status and also gives information regarding train
late to people through the database.
Conceptual Conceptual
view
Schema
ID : Int
Dept : Varchar
Address : Varchar
External View
This level is used by individual user , it is the highest
level of database , any number of users can work on
this level.
ID
Dept
Address
Salary
DBMS Language
For programming we use language, Language use so many
command, and instruction and for different – different
operation we use different – different commands same as if
we want to operate the database then we use DBMS
language.
It also provides so many command & syntax and for
different –different operation we use different –different
command.
DBMS language classified into 4 type
DDL ( Data Definition Language)
DML( Data Manipulation Language)
DCL ( Data Control Language
TCL (Transaction Control Language)
DDL ( Data Definition Language)
This language is used to define the data structure of table
with the help of DDL we can create the new table , delete
the table & change the structure of tables.
The DDL operates on structure which are used to store
data in the database .
“ It contains a sets of definition which is expressed by a
special language called data definition language”. In this
language we use so many command such as
Create , Drop , Alter .
DML ( Data Manipulation Language)
This language is used to manipulate the database , in this
language we perform display , insert , modify & delete
operation in the table.
This means with the help of this language we can insert the
data in a table , we can change the record of table and we
can also delete the record of table.
DML are of 2 types :
1. Procedural DML
2. Non-Procedural DML
Data Control Language (DCL) :
This language is used to control the user to access the data
base that’s it gives the permission to user.
All the security to the database are provide by data control
language .
DCL is collection of some statement which are used to
control the data object creating using DDL statement . The
most common control statements are Grant & Revoke .
Transaction Control Language
This language is used to control the transactions of
users. If users apply some transaction operation on the
table then to maintain transaction we use it.
Example – commit, rollback
DATA INDEPENDENCY
In DBMS create so many database ,and in this database
we store the records when we create any database or table .
Then 1st define the schema or relation , and after that we
enter the data.
If we change the database then we can change the schema
or we can change the records, when we change the schema
then other schema are not change this concept is called
data independency.
Types of independency
1. Logical data independency
2. Physical data independency
Physical Data Independency
When the physical storage structure or devices used for
storing data can be changed with affecting the
conceptual schema or any of the external view . This
means physical data independency has the capacity to
change the internal schema without having to change the
conceptual or external schema .
Logical Data Independency
When the conceptual schema can be change without
effecting the existing internal schema is called logical data
independency , Conceptual schema is change to expand
database or to remove records or data item.
But this addition or deletion does not effect internal view ,
This independency also insulates application programs
from operation such as combining two records in to 1
records or splitting an existing records in to 2 or more
records .
Data Model
Data Model gives us an idea that how the final system
will look like after its complete implementation. It
defines the data elements and the relationships between
the data elements. Data Models are used to show how
data is stored, connected, accessed and updated in the
database management system.
Data Model
1. Hierarchical Model
2. Network Model
3. Entity-Relationship Model
4. Relational Model
Data Model
Hierarchical Model was the first DBMS model. This
model organises the data in the hierarchical tree
structure. The hierarchy starts from the root which has
root data and then it expands in the form of a tree
adding child node to the parent node.
Hierarchical Model
Hierarchical Model was the first DBMS model. This
model organises the data in the hierarchical tree
structure. The hierarchy starts from the root which has
root data and then it expands in the form of a tree
adding child node to the parent node.
Hierarchical Model
Example: We can represent the relationship between the shoes
present on a shopping website in the following way:
Hierarchical Model
Advantages of Hierarchical ModelIt is very simple and
fast to traverse through a tree-like structure.
Any change in the parent node is automatically
reflected in the child node so, the integrity of data is
maintained.
Hierarchical Model
Disadvantages of Hierarchical ModelComplex
relationships are not supported.
As it does not support more than one parent of the child
node so if we have some complex relationship where a
child node needs to have two parent node then that can't
be represented using this model.
If a parent node is deleted then the child node is
automatically deleted.
Network Model
This model is an extension of the hierarchical model. It
was the most popular model before the relational
model. This model is the same as the hierarchical
model, the only difference is that a record can have
more than one parent.
Network Model
Example: In the example below we can see that node
student has two parents i.e. CSE Department and
Library. This was earlier not possible in the hierarchical
model.
Network Model
The data can be accessed faster as compared to the
hierarchical model. This is because the data is more
related in the network model and there can be more
than one path to reach a particular node. So the data can
be accessed in many ways.
As there is a parent-child relationship so data integrity
is present. Any change in parent record is reflected in
the child record.
Network Model
As more and more relationships need to be handled the
system might get complex. So, a user must be having
detailed knowledge of the model to work with the
model.
Any change like updation, deletion, insertion is very
complex.
Entity-Relationship Model
Entity-Relationship Model or simply ER Model is a
high-level data model diagram. In this model, we
represent the real-world problem in the pictorial form
to make it easy for the stakeholders to understand. It is
also very easy for the developers to understand the
system by just looking at the ER diagram. We use the
ER diagram as a visual tool to represent an ER Model.
Entity-Relationship Model
ER Model. ER diagram has the following three
components:
Entities: Entity is a real-world thing. It can be a person,
place, or even a concept. Example: Teachers, Students,
Course, Building, Department, etc are some of the
entities of a School Management System.
Attributes: An entity contains a real-world property
called attribute. This is the characteristics of that
attribute. Example: The entity teacher has the property
like teacher id, salary, age, etc.
Entity-Relationship Model
Relationship: Relationship tells how two attributes are
related. Example: Teacher works for a department.
Example:
Entity-Relationship Model
In the above diagram, the entities are Teacher and
Department. The attributes of Teacher entity are
Teacher_Name, Teacher_id, Age, Salary,
Mobile_Number. The attributes of
entity Department entity are Dept_id, Dept_name. The
two entities are connected using the relationship. Here,
each teacher works for a department.
Entity-Relationship Model
Advantages of ER ModelSimple: Conceptually ER
Model is very easy to build. If we know the relationship
between the attributes and the entities we can easily
build the ER Diagram for the model.
Effective Communication Tool: This model is used
widely by the database designers for communicating
their ideas.
Entity-Relationship Model
Disadvatages of ER ModelNo industry standard for
notation: There is no industry standard for developing
an ER model. So one developer might use notations
which are not understood by other developers.
Hidden information: Some information might be lost
or hidden in the ER model. As it is a high-level view so
there are chances that some details of information
might be hidden.
Relational Model
Relational Model is the most widely used model. In this
model, the data is maintained in the form of a
two-dimensional table. All the information is stored in
the form of row and columns. The basic structure of a
relational model is tables. So, the tables are also
called relations in the relational model. Example: In
this example, we have an Employee table.
Relational Model
Relational Model
Features of Relational ModelTuples: Each row in
the table is called tuple. A row contains all the
information about any instance of the object. In the
above example, each row has all the information
about any specific individual like the first row has
information about John.
Attribute or field: Attributes are the property
which defines the table or relation. The values of
the attribute should be from the same domain. In
the above example, we have different attributes of
the employee like Salary, Mobile_no, etc.
Relational Model
Advnatages of Relational Model
Simple: This model is more simple as compared to
the network and hierarchical model.
Scalable: This model can be easily scaled as we can
add as many rows and columns we want.
Structural Independence: We can make changes in
database structure without changing the way to
access the data. When we can make changes to the
database structure without affecting the capability to
DBMS to access the data we can say that structural
independence has been achieved.
The people who are accessing or working with the
database are called database users and administrators.
We know that the primary aim of the DBMS is to store
the data or information and retrieve whenever it is
needed by the database users.
Database Users and Administrators
Those who are working with the database can be
categorized into two; the database users and the
database administrators.
Database User
The database users also can be categorized again into
five groups according to how they interact with the
database. They are:
Specialized Users
Application Programmers
Sophisticated Users
Specialized Users
Stand-alone Users
Native User
These are the database users who are
communicating with the database through an
already written program.
For example, when a student is registering on a
website for an online examination. He creates
data in the database by entering and submitting
his name, address and exam details.
Application Programmer
These are the software developers and
programming professionals who write the program
codes.
Sophisticated Users
Sophisticated users are those who are creating the
database. These type of users do not write program
code. And they do not use any software to request the
database.
The sophisticated users directly interact with the
database system using query languages like SQL.
Specialized User
The sophisticated users who write
special database application programs are called
specialized users. The write complex programs for
the specific complex requirements.
Stand Alone User
Those who are using database fo personal usage.
There are many database packages for this type
database users.
DBA(DATABASE ADMINISTRATOR)
The person who has the central control over a
database system is called Database
Administrator (DBA).
The database administrator has the following
functions in a database system.
Schema Definition: The database administrator
creates the original database schema by
executing a set of data definition statements in
DDL
FUNCTIONS OF DBA
Storage structure an access method definition.
Schema and physical or organization
modification: The database
administrator performs the changes to the schema
according to the needs of organizations or
physical needs to improve the database
performance.
FUNCTIONS OF DBA
Provide the granting of authorization to access
data: The database administrator can decide the
which parts of the database can be accessed by a
user, by using the different types of authorization
methods.
Database maintenance: The database
maintenance includes the following processes.
Regular backing up of the database.
Ensuring the disk space for performing the
required operations.
Monitoring the jobs running on the database.