0% found this document useful (0 votes)
7 views57 pages

DBMS 1

Uploaded by

dhirruusinghh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views57 pages

DBMS 1

Uploaded by

dhirruusinghh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 57

DBMS

A Database Management System (DBMS) is a


software system that is designed to manage and
organize data in a structured manner. It allows users
to create, modify, and query a database, as well as
manage the security and access controls for that
database.
What is Database
The database is a collection of inter-related data
which is used to retrieve, insert and delete the data
efficiently. It is also used to organize the data in the
form of a table, schema, views, and reports, etc.
Database Management System
• Database management system is a software
which is used to manage the database. For
example: MYSQL,Oracle
• DBMS provides an interface to perform various
operations like database creation, storing data
in it, updating data, creating a table in the
database and a lot more.
• It provides protection and security to the
database. In the case of multiple users, it also
maintains data consistency.
key features of a DBMS include
Data modeling: A DBMS provides tools for creating
and modifying data models, which define the
structure and relationships of the data in a database.
Data storage and retrieval: A DBMS is responsible
for storing and retrieving data from the database,
and can provide various methods for searching and
querying the data.
Concurrency control: A DBMS provides mechanisms
for controlling concurrent access to the database, to
ensure that multiple users can access the data
without conflicting with each other.
Data integrity and security: A DBMS provides
tools for enforcing data integrity and security
constraints, such as constraints on the values of
data and access controls that restrict who can
access the data.
Backup and recovery: A DBMS provides
mechanisms for backing up and recovering the
data in the event of a system failure.
DBMS can be classified into two types: Relational
Database Management System (RDBMS) and Non-
Relational Database Management System (NoSQL
or Non-SQL)
RDBMS: Data is organized in the form of tables
and each table has a set of rows and columns. The
data is related to each other through primary and
foreign keys.
NoSQL: Data is organized in the form of key-value
pairs, document, graph, or column-based. These
are designed to handle large-scale, high-
performance scenarios.
Database Management System
• Data Definition: It is used for creation, modification, and
removal of definition that defines the organization of data in
the database.
• Data Updation: It is used for the insertion, modification, and
deletion of the actual data in the database.
• Data Retrieval: It is used to retrieve the data from the
database which can be used by applications for various
purposes.
• User Administration: It is used for registering and monitoring
users, maintain data integrity, enforcing data security,
dealing with concurrency control, monitoring performance
and recovering information corrupted by unexpected failure.
Characteristics of DBMS
• It uses a digital repository established on a server to store
and manage the information.
• It can provide a clear and logical view of the process that
manipulates data.
• DBMS contains automatic backup and recovery procedures.
• It contains ACID properties which maintain data in a healthy
state in case of failure.
• It can reduce the complex relationship between data.
• It is used to support manipulation and processing of data.
• It is used to provide security of data.
• It can view the database from different viewpoints
according to the requirements of the user.
Advantages of DBMS
• Controls database redundancy: It can control data redundancy
because it stores all the data in one single database file and that
recorded data is placed in the database.
• Data sharing: In DBMS, the authorized users of an organization can
share the data among multiple users.
• Easily Maintenance: It can be easily maintainable due to the
centralized nature of the database system.
• Reduce time: It reduces development time and maintenance need.
• Backup: It provides backup and recovery subsystems which create
automatic backup of data from hardware and software failures and
restores the data if required.
• multiple user interface: It provides different types of user interfaces
like graphical user interfaces, application program interfaces
Disadvantages of DBMS
• Cost of Hardware and Software: It requires a high speed
of data processor and large memory size to run DBMS
software.
• Size: It occupies a large space of disks and large memory
to run them efficiently.
• Complexity: Database system creates additional
complexity and requirements.
• Higher impact of failure: Failure is highly impacted the
database because in most of the organization, all the
data stored in a single database and if the database is
damaged due to electric failure or database corruption
then the data may be lost forever.
Basis DBMS Approach File System Approach
Meaning DBMS is a collection of data. In The file system is a collection of data.
DBMS, the user is not required to In this system, the user has to write
write the procedures. the procedures for managing the
database.
Sharing Due to the centralized approach, Data is distributed in many files, and it
of data data sharing is easy. may be of different formats, so it isn't
easy to share data.
Data DBMS gives an abstract view of The file system provides the detail of
Abstraction data that hides the details. the data representation and storage of
data.

Security DBMS provides a good protection It isn't easy to protect a file under the
and mechanism. file system.
Protection
Recovery DBMS provides a crash recovery The file system doesn't have a crash
Mechanism mechanism, i.e., DBMS protects mechanism, i.e., if the system crashes
the user from system failure. while entering some data, then the
content of the file will be lost.
Concurrency DBMS takes care of Concurrent In the File system, concurrent
Problems access of data using some form access has many problems like
of locking. redirecting the file while
deleting some information or
updating some information.

Where to use Database approach used in large File system approach used in
systems which interrelate many large systems which interrelate
files. many files.
Cost The database system is The file system approach is
expensive to design. cheaper to design.
Data Redundancy Due to the centralization of the In this, the files and application
and Inconsistency database, the problems of data programs are created by
redundancy and inconsistency different programmers so that
are controlled. there exists a lot of duplication
of data which may lead to
inconsistency.

Structure The database structure is The file system approach has a


complex to design. simple structure.
Data In this system, Data In the File system approach,
Independence Independence exists, and it can there exists no Data
be of two types.Logical Data Independence.
Independence
Physical Data Independence

Integrity Integrity Constraints are easy to Integrity Constraints are difficult


Constraints apply. to implement in file system.
Data Models In the database approach, 3 In the file system approach,
types of data models there is no concept of data
exist:Hierarchal data models models exists.
Network data models
Relational data models

Flexibility Changes are often a necessity to The flexibility of the system is


the content of the data stored in less as compared to the DBMS
any system, and these changes approach.
are more easily with a database
approach.
Data Models
• Data Model is the modeling of the data description, data semantics, and
consistency constraints of the data. It provides the conceptual tools for
describing the design of a database at each level of data abstraction.
Therefore, there are following four data models used for understanding
the structure of the database:
Relational Data Model: This type of model designs the data in the form
of rows and columns within a table. Thus, a relational model uses tables
for representing data and in-between relationships. Tables are also
called relations. This model was initially described by Edgar F. Codd, in
1969. The relational data model is the widely used model which is
primarily used by commercial data processing applications.

Entity-Relationship Data Model: An ER model is the logical


representation of data as objects and relationships among them.
These objects are known as entities, and relationship is an
association among these entities. This model was designed by
Peter Chen and published in 1976 papers. It was widely used in
database designing. A set of attributes describe the entities. For
example, student_name, student_id describes the 'student' entity.
A set of the same type of entities is known as an 'Entity set', and
the set of the same type of relationships is known as 'relationship
set'.
Object-based Data Model: An extension of the ER model with notions
of functions, encapsulation, and object identity, as well. This model
supports a rich type system that includes structured and collection
types. Thus, in 1980s, various database systems following the object-
oriented approach were developed. Here, the objects are nothing but
the data carrying its properties.
Semistructured Data Model: This type of data model is different
from the other three data models (explained above). The
semistructured data model allows the data specifications at
places where the individual data items of the same type may
have different attributes sets. The Extensible Markup Language,
also known as XML, is widely used for representing the
semistructured data. Although XML was initially designed for
including the markup information to the text document, it gains
importance because of its application in the exchange of data.
Data model Schema and Instance
• The data which is stored in the database at a particular
moment of time is called an instance of the database.
• The overall design of a database is called schema.
• A database schema is the skeleton structure of the database. It
represents the logical view of the entire database.
• A schema contains schema objects like table, foreign key,
primary key, views, columns, data types, stored procedure, etc.
• A database schema can be represented by using the visual
diagram. That diagram shows the database objects and
relationship with each other.
• A database schema is designed by the database designers to
help programmers whose software will interact with the
database. The process of database creation is called data
modeling.
Data Independence
• Data independence refers characteristic of being able to modify the
schema at one level of the database system without altering the
schema at the next higher level.
• There are two types of data independence:
Logical Data Independence

• Logical data independence refers characteristic


of being able to change the conceptual schema
without having to change the external schema.
• Logical data independence is used to separate
the external level from the conceptual view.
• If we do any changes in the conceptual view of
the data, then the user view of the data would
not be affected.
• Logical data independence occurs at the user
interface level.
Physical Data Independence
• Physical data independence can be defined as the
capacity to change the internal schema without
having to change the conceptual schema.
• If we do any changes in the storage size of the
database system server, then the Conceptual
structure of the database will not be affected.
• Physical data independence is used to separate
conceptual levels from the internal levels.
• Physical data independence occurs at the logical
interface level.
Database Languages in DBMS
A DBMS has appropriate languages and interfaces to express database
queries and updates.
Database languages can be used to read, store and update the data in the
database.
Data Definition Language (DDL)
• DDL stands for Data Definition Language. It is used to define database
structure or pattern.
• It is used to create schema, tables, indexes, constraints
• Using the DDL statements, you can create the skeleton of the database.
• DDL is used to store the information of metadata like the number of tables
and schemas, their names, indexes, columns in each table, constraints,
Commands
• Create: It is used to create objects in the database.
• Alter: It is used to alter the structure of the database.
• Drop: It is used to delete objects from the database.
• Truncate: It is used to remove all records from a table.
• Rename: It is used to rename an object.
• Comment: It is used to comment on the data dictionary.
Data Manipulation Language (DML)
DML stands for Data Manipulation Language. It is used for accessing
and manipulating data in a database. It handles user requests.
Commands
• Select: It is used to retrieve data from a database.
• Insert: It is used to insert data into a table.
• Update: It is used to update existing data within a table.
• Delete: It is used to delete all records from a table.
• Merge: It performs UPSERT operation, i.e., insert or update
operations.
• Call: It is used to call a structured query language or a Java
subprogram.
• Explain Plan: It has the parameter of explaining data.
• Lock Table: It controls concurrency.
• Data Control Language (DCL)
DCL stands for Data Control Language. It is used to retrieve the
stored or saved data.
The DCL execution is transactional. It also has rollback
parameters.
Commands
• Grant: It is used to give user access privileges to a database.
• Revoke: It is used to take back permissions from the user.
Transaction Control Language (TCL)
TCL is used to run the changes made by the DML
statement. TCL can be grouped into a logical
transaction.
Commands
• Commit: It is used to save the transaction on
the database.
• Rollback: It is used to restore the database to
original since the last Commit.
DBMS Architecture
Types of DBMS Architecture
1-Tier Architecture
• In this architecture, the database is directly
available to the user. It means the user can
directly sit on the DBMS and uses it.
• Any changes done here will directly be done
on the database itself. It doesn't provide a
handy tool for end users.
• The 1-Tier architecture is used for
development of the local application, where
programmers can directly communicate with
the database for the quick response.
2-Tier Architecture
• The 2-Tier architecture is same as basic client-server. In the two-tier
architecture, applications on the client end can directly communicate with
the database at the server side.
3-Tier Architecture
• The 3-Tier architecture contains
another layer between the client and
server. In this architecture, client
can't directly communicate with the
server.
• The application on the client-end
interacts with an application server
which further communicates with
the database system.
• End user has no idea about the
existence of the database beyond the
application server. The database also
has no idea about any other user
beyond the application.
Three schema Architecture
• Framework is used to describe the structure of
a specific database system.
• The three schema architecture is also used to
separate the user applications and physical
database.
• The three schema architecture contains three-
levels. It breaks the database down into three
different categories.
Database Administrator (DBA)
A Database Administrator (DBA) is an individual or person responsible for
controlling, maintaining, coordinating, and operating a database management
system. Managing, securing, and taking care of the database systems is a prime
responsibility. They are responsible and in charge of authorizing access to the
database, coordinating, capacity, planning, installation, and monitoring uses,
and acquiring and gathering software and hardware resources as and when
needed. Their role also varies from configuration, database design, migration,
security, troubleshooting, backup, and data recovery. Database administration
is a major and key function in any firm or organization that is relying on one or
more databases. They are overall commanders of the Database system.
Role and Duties of Database Administrator (DBA)
Decides hardware Manages data integrity and security
Database Accessibility Database design
Database implementation Query processing performance
Tuning Database Performance
Various responsibilities of Database Administrator (DBA)

• Responsible for designing overall database schema (tables & fields).


• To select and install database software and hardware.
• Responsible for deciding on access methods and data storage.
• DBA selects appropriate DBMS software like oracle, SQL server or
MySQL.
• Used in designing recovery procedures.
• DBA decides the user access level and security checks for accessing,
modifying or manipulating data.
• DBA is responsible for specifying various techniques for monitoring
the database performance.
• DBA is responsible for operation managements.
• The operation management deals with the data problems which
arises on day to day basis, and the responsibilities include.
ER Model
The Entity Relational Model is a model for identifying
entities to be represented in the database and
representation of how those entities are related. The
ER data model specifies enterprise schema that
represents the overall logical structure of a database
graphically.
The Entity Relationship Diagram explains the
relationship among the entities present in the
database. ER models are used to model real-world
objects
ER Diagram is the structural format of the database.
Why Use ER Diagrams In DBMS?
• ER diagrams are used to represent the E-R model in a
database, which makes them easy to be converted into
relations (tables).
• ER diagrams provide the purpose of real-world modeling
of objects which makes them intently useful.
• ER diagrams require no technical knowledge and no
hardware support.
• These diagrams are very easy to understand and easy to
create even for a naive user.
• It gives a standard solution for visualizing the data
logically.
Symbols Used in ER Model
• Rectangles: Rectangles represent Entities in the ER
Model.
• Ellipses: Ellipses represent Attributes in the ER Model.
• Diamond: Diamonds represent Relationships among
Entities.
• Lines: Lines represent attributes to entities and entity sets
with other relationship types.
• Double Ellipse: Double Ellipses represent multi-valued
Attributes.
• Double Rectangle: Double Rectangle represents a Weak
Entity.
Components of ER Diagram

• ER Model consists of Entities, Attributes, and


Relationships among Entities in a Database
System.
Entity
• An Entity may be an object with a
physical existence – a particular person,
car, house, or employee – or it may be an
object with a conceptual existence – a
company, a job, or a university course.
• Entity Set: An Entity is an object of Entity
Type and a set of all entities is called an
entity set. For Example, E1 is an entity
having Entity Type Student and the set of
all students is called Entity Set.
Entity Type
Strong Entity:- is a type of entity that has a key
Attribute. Strong Entity does not depend on other
Entity in the Schema. It has a primary key, that helps in
identifying it uniquely, and it is represented by a
rectangle. These are called Strong Entity Types.
Weak Entity:- An Entity type has a key attribute that
uniquely identifies each entity in the entity set. But
some entity type exists for which key attributes can’t be
defined. These are called Weak entity types.
Attributes
Attributes are the properties that define the entity type. For
example, Roll_No, Name, DOB, Age, Address, and Mobile_No
are the attributes that define entity type Student.
The attribute is represented by an oval.
Type of Attribute
1. Key Attribute
The attribute which uniquely identifies each entity in the entity
set is called the key attribute. For example, Roll_No will be
unique for each student. In ER diagram, the key attribute is
represented by an oval with underlying lines.
• Composite Attribute:- An attribute composed of
many other attributes is called a composite
attribute. For example, the Address attribute of the
student Entity type consists of Street, City, State, and
Country. In ER diagram, the composite attribute is
represented by an oval comprising of ovals.
Multivalued Attribute:- An attribute consisting
of more than one value for a given entity. For
example, Phone_No (can be more than one for a
given student). In ER diagram, a multivalued
attribute is represented by a double oval.
Derived Attribute:- An attribute that can be
derived from other attributes of the entity type
is known as a derived attribute. e.g.; Age (can be
derived from DOB). In ER diagram, the derived
attribute is represented by a dashed oval.
Relationship Type and Relationship Set
• A Relationship Type represents the association between entity
types. For example, ‘Enrolled in’ is a relationship type that exists
between entity type Student and Course. In ER diagram, the
relationship type is represented by a diamond and connecting the
entities with lines.
Degree of a Relationship Set
• 1. Unary Relationship: When there is only
ONE entity set participating in a relation, the
relationship is called a unary relationship. For
example, one person is married to only one
person.
Binary Relationship: When there are TWO
entities set participating in a relationship, the
relationship is called a binary relationship. For
example, a Student is enrolled in a Course.

n-ary Relationship: When there are n entities


set participating in a relation, the relationship is
called an n-ary relationship.
Cardinality:- The number of times an entity of an entity set participates in a

relationship set is known as Cardinality . Cardinality can be of different types:

One-to-One
One-to-Many
Many-to-One
Many-to-Many
Generalization and specialization are the Enhanced Entity
Relationship diagram (EER-diagram)

• Generalization :It works on the principle of bottom


up approach. In Generalization lower level
functions are combined to form higher level
function which is called as entities. This process is
repeated further to make advanced level entities.
• In the Generalization process properties are drawn
from particular entities and thus we can create
generalized entity. We can summarize
Generalization process as it combines subclasses
to form superclass.
Specialization
• We can say that Specialization is opposite of
Generalization. In Specialization things are
broken down into smaller things to simplify it
further. We can also say that in Specialization
a particular entity gets divided into sub
entities and it’s done on the basis of it’s
characteristics. Also in Specialization
Inheritance takes place.
Network Data Model
It is advance version of hierarchical data model. To
organize data it uses directed graphs instead of tree-
structure. In this child can have more than one parent.
It uses concept of two data structures i.e., Records and
Sets.
Relational Data Model
The relational data model was developed by E.F.
Codd in 1970. There are no physical links as they
are in hierarchical data model.
• Data is represented in form of table only.
• It deals only with data not with physical structure.
• It provides information regarding metadata.
• At the intersection of row and column there will be
only one value for tuple.
• It provides a way to handle queries with ease.
Difference between Network and
Relational Data Model
Network Data Model Relational Data Model

It organizes records to one another through It organizes records in form of table and
links or pointers. relationship between tables are set using
common fields.

It organizes records in form of directed graphs. It organizes records in form of tables.

In this relationship between various records is In this relationship between various records is
represented physically via linked list. represented logically via tables.

There is lack of declarative querying facilities. It provides declarative query facility using SQL.

Complexity increases burden on programmer As physical level details are hidden from end
for database design as well as data users so this model is very simple to
manipulation. understand.
Network Data Model Relational Data Model

Retrieval algorithms are complex but symmetric. Retrieval algorithms are simple and symmetric.

There is partial data independence in this model. This model provides data independence.

There is no inconsistency problem in updating the records The updating of records is quite easy because of the normalization
because of the single instance of the child records. which is used to remove the redundancy in the relations.

Searching for a record is easy in the network model as there In the relational model, a unique, indexed key serves the purpose of
are multiple access paths to reach data item. searching a record.

It maintains logical organization of records using rows and columns


Here, is the physical existence of record relations in this model.
and stored in relation.

VAX-DBMS, DMS-1100 of UNIVAC and SUPRADBMS’s use this


It is mostly used in real world applications. Oracle, SQL.
model.

You might also like