DBMS Unit-I
DBMS Unit-I
Database Applications
Nowadays, any business that has small or large amounts of data needs
a database to store and manage the information. The database is an
easy, reliable, secure, and efficient way to maintain business
information. There are many applications where databases are used.
1. Universities:
It is an undeniable application of the database. Universities have so
much data which can be stored in the database, such as student
information, teacher information, non-teaching staff information,
1
course information, section information, grade report information, and
many more. University information is kept safe and secure in the
database.
2. Banking:
It is one of the major applications of databases. Banks have a huge
amount of data as millions of people have accounts that need to be
maintained properly. The database keeps the record of each user in a
systematic manner. Banking databases store a lot of information about
account holders. It stores customer details, asset details, banking
transactions, balance sheets, credit card and debit card details, loans,
fixed deposits, and much more. Everything is maintained with the
help of a database.
2
the information needs to be maintained, so railways use a database
management system for their efficient storage and retrieval purpose.
6. E-commerce Websites:
E-commerce websites are one of the prominent applications of the
database. Websites such as Flipkart, Myntra, Amazon, Nykaa,
Snapdeal, Shopify, and many more, are online shopping websites
where people buy items online. These websites have so much data.
These websites use databases to securely store and maintain customer
3
details, product details, dealer details, purchase details, bank & card
details, transactions details, invoice details, etc. You can analyze the
sales and maintain the inventory with the help of a database.
7. Medical:
There is a lot of important data collection in the medical field, so it is
necessary to use the database to store data related to the medical field,
such as patient details, medicine details, practitioner details, surgeon
details, appointment details, doctor schedule, patient discharge details,
payment detail, invoices, and other medical records. The database
management system is a boon for the medical field because it helps
doctors to monitor their patients and provide better care.
9. Industries:
The database management system is the main priority of industries
because they need to store huge amounts of data. The industry
database stores customer details, sales records, product lists,
4
transactions, etc. All the information is kept secure and maintained by
the database.
11. Telecommunication:
We cannot deny that telecommunication has brought a remarkable
revolution worldwide. The Telecom field has huge data, and it is very
difficult to manage big data without a database; that is why a telecom
database is required, which stores data such as customer names,
phone numbers, calling details, prepaid & post-paid connection
records, network usage, bill details, balance details, etc.
12. Manufacturing:
In the manufacturing field, a lot of data needs to be maintained
regarding supply chain management, so the database maintains the
data such as product details, customer information, order details,
purchase details, payment info, worker's details, invoice, etc.
Manufacturing companies produce and supply products every day, so
it is important to use a database.
5
13. Human Resource Management:
Any organization will definitely have employees, and if there are a
large number of employees, then it becomes essential to store data in a
database as it maintains and securely saves the data, which can be
retrieved and accessed when required. The human resource database
stores data such as employee name, joining details, designation, salary
details, tax information, benefits & goodies details, etc.
14. Broadcasting:
Broadcasting is distributing video and audio content to a dispersed
audience by television, radio, or other means. Broadcasting database
stores data such as subscriber information, event recordings, event
schedules, etc., so it becomes important to store broadcasting data in
the database.
15. Insurance:
An insurance company needs a database to store large amounts of
data. Insurance database stores data such as policy details, user
details, buyer details, payment details, nominee details, address
details, etc.
6
A Historical Perspective
Database Management Systems (DBMS) have been around for
several decades, and their history can be traced back to the early
1960s. In the early days, computer systems were designed to manage
data in a hierarchical or navigational manner, where data was stored
in a tree-like structure. This method of storing data was inefficient and
difficult to use, as it required a lot of manual effort to access and
manage the data.
7
corporate and government applications. SQL was adopted by the
American National Standards Institute (ANSI) and International
Organization for Standardization (ISO).
8
Some of the most popular DBMS systems in use today include
Oracle, Microsoft SQL Server, MySQL, PostgreSQL, and MongoDB.
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.
For example: The college Database organizes the data about the
admin, staff, students and faculty etc.
Using the database, you can easily retrieve, insert, and delete the
information.
9
DBMS allows users the following tasks:
o Data Definition: It is used for creation, modification, and
removal of definition that defines the organization of data in the
database.
o Data Updation: It is used for the insertion, modification, and
deletion of the actual data in the database.
o Data Retrieval: It is used to retrieve the data from the database
which can be used by applications for various purposes.
o 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
o It uses a digital repository established on a server to store and
manage the information.
o It can provide a clear and logical view of the process that
manipulates data.
o DBMS contains automatic backup and recovery procedures.
o It contains ACID properties which maintain data in a healthy
state in case of failure.
o It can reduce the complex relationship between data.
o It is used to support manipulation and processing of data.
o It is used to provide security of data.
10
o It can view the database from different viewpoints according to
the requirements of the user.
Advantages of DBMS
o 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.
o Data sharing: In DBMS, the authorized users of an
organization can share the data among multiple users.
o Easily Maintenance: It can be easily maintainable due to the
centralized nature of the database system.
o Reduce time: It reduces development time and maintenance
need.
o Backup: It provides backup and recovery subsystems which
create automatic backup of data
from hardware and software failures and restores the data if
required.
o multiple user interface: It provides different types of user
interfaces like graphical user interfaces, application program
interfaces
Disadvantages of DBMS
o Cost of Hardware and Software: It requires a high speed of
data processor and large memory size to run DBMS software.
11
o Size: It occupies a large space of disks and large memory to run
them efficiently.
o Complexity: Database system creates additional complexity and
requirements.
o 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.
o Redundant data
o In DBMS there is
o Data can be present in a
no redundant data.
Redundancy file system.
12
o Basics o File System o DBMS
o There is no
o Efficient query
efficient query
processing is there
o Query processing in the
in DBMS.
processing file system.
o It has more
o It is less complex complexity in
as compared to handling as
DBMS. compared to the file
o Complexity system.
13
o Basics o File System o DBMS
DBMS. systems.
o It has a
o It is less expensive comparatively
than DBMS. higher cost than a
o Cost file system.
o In DBMS data
independence exists,
mainly of two types:
o There is no data
o 1) Logical Data
independence.
o Data Independence .
Independenc o 2)Physical Data
e Independence.
14
o Basics o File System o DBMS
it is not easy to
is easy
share data.
o It give details of
storage and o It hides the internal
o Data representation of details of Database
Abstraction data
o Integrity
o Integrity constraints
Constraints are
are easy to
o Integrity difficult to
implement
Constraints implement
o To access data in a
file , user requires
o No such attributes
attributes such as
are required.
file name, file
o Attribute s location.
Time-consuming.
16
Reduction of redundancy.
Data independence.
Data Models:
1.Hierarchical Model
2. Network Model
3. Entity-Relationship Model
5. Relational Model
Example
17
The following diagram depicts the relationship between the shoes
available on a shopping website:
2.Network Model
The main difference between this model and the hierarchical model is
that any record can have several parents in the network model. It uses
a graph instead of a hierarchical tree.
Example
We can observe that the node student has two parents, CSE
Department and Library, in the example below. In the hierarchical
model, this was previously impossible.
3.Entity-Relationship Model
18
The real-world problem is depicted in visual form in this model to
make it easier for stakeholders to comprehend. The ER diagram also
makes it very simple for developers to comprehend the system.
Example
19
Examples
Here is an example of this model:
20
The Employee and Department are the two objects in the example
above. Each object’s data and the relationships are there in a single
unit. Here, the attributes of the employee, such as Name and Job_title,
as well as the methods that will be performed by that object, are all
kept in a single object. The two objects are linked by a common
attribute, i.e., Department_id, as well as communication between
them will be accomplished by this common id.
5.Relational Model
The data in this model is kept in the form of a table that is two-
dimensional. All of the data is kept in the form of rows and columns.
Tables are the foundation of a relational paradigm.
EMPLOYEE
21
ID_NO NAME ADDRESS ROLL_NO AGE
C1 RIYA DELHI 15 20
C2 SUNITA GURGAON 16 22
C3 ASHWANI ROHTAK 12 18
C4 PREETI DELHI 25
22
abstraction that hide irrelevant details from the users. Levels of
abstraction simplify database design.
It uses the physical data model. It is used to define that how the data
will be stored in a block.
23
Facts about Internal schema
The internal schema is the lowest level of data abstraction
The internal view tells us what data is stored in the database and how
24
3. View or External Level
It hides the unrelated details of the database from the user. There may
be “n” number of external views for each database.
View level can be used by all users (all levels' users). This level is the
least complex and easy to understand.
Data Independence
o Data independence can be explained using the three-schema
architecture.
25
o 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.
26
o Physical data independence occurs at the logical interface level.
Structure of DBMS
27
Query Processor:
The interactive query processor helps the database system to simplify
and facilitate access to data. It consists of DDL(Data Definition
Language) interpreter, DML(Data Manipulation Language)
compiler and query evaluation engine.
28
DML compiler: It translates DML statements query language
into an evaluation plan. This plan consists of the instructions
which query evaluation engine understands.
Storage manager:
Storage manager is the component of database system that provides
interface between the low level data stored in the database and the
application programs and queries submitted to the system.
29
File manager: Manages allocation of space on disk storage and
representation of the information on disk.
ER Diagrams in DBMS
ER model in DBMS is the high-level data model. It stands for the
Entity-relationship model and is used to represent a logical view of
the system from a data perspective. In simple words, the entity
relationship diagram is a blueprint that can used to create a database.
E-R diagrams are used to model real-world objects like a person, a
car, a company and the relation between these real-world objects.
30
Features of ER model
E-R diagrams are used to represent E-R model in a database,
which makes them easy to be converted into relations (tables).
31
Component Symbol
Entity
Weak Entity
Attribute
Key Attribute
Composite
Attribute
Multivalued
Attribute
Derived
Attribute
Relationship
Weak
Relationship
Participation
Constraints
32
Attributes in DBMS
Attributes define the properties of a data object of entity. For example
if student is an entity, his ID, name, address, date of birth, class are its
attributes.
1. Simple Attributes:
Simple attributes are attributes that are drawn from the atomic value
domains, which cannot be divided further.
2. Composite attribute:
Composite attributes are those attributes which are composed of many
other simple attributes. Composite attributes are made of more than
one simple attribute. For example, a student's complete name may
have first-name and last-name.
33
Simple Vs. Composite Attributes
Simple Attribute Composite Attribute
The attribute which cannot further The file system provides the
split into its components is a details of data representation and
simple attribute. storage of data.
34
4. Multi Valued Attributes:
Multi valued attributes are those attributes which can take more than
one value for a given entity from an entity set. Multi-value attributes
may contain more than one values. For example, a person know more
than one Languages, hobbies etc.
35
Single-Valued Vs. Multi-Valued Attributes
Single-Valued Attribute Multi-Valued Attribute
5. Derived Attributes:
Derived attributes are those attributes which can be derived from
other attribute(s).
Derived attributes are the attributes that do not exist in the physical
database, but their values are derived from other attributes present in
the database. For example, age of the student should not be saved
directly in the database, instead it can be derived from Date of Birth.
36
Stored Vs. Derived Attributes
Stored Attribute Derived Attributes
6. Key Attributes:
Key attributes are those attributes which can identify an entity
uniquely in an entity set.
37
Key is an attribute or collection of attributes that uniquely identifies
an entity among entity set. For example, the roll_number of a student
makes him/her identifiable among students.
Entity in DBMS
Entity: An entity is anything in the real world, such as an object,
class, person, or place. Objects that physically exist and are logically
constructed in the real world are called entities. An entity is
distinguishable from other entity.
38
Entity type: The entity type is a collection of the entity having
similar attributes.
Weak Entity – Weak entity type doesn’t have a key attribute and so
we cannot uniquely identify them by their attributes alone. Therefore,
a foreign key must be used in combination with its attributes to create
a primary key. They are called Weak entity types because they can’t
be identified on their own. It relies on another powerful entity for its
unique identity. A weak entity is represented by a double-outlined
rectangle in ER diagrams.
39
Strong Entity v/s Weak Entity
Strong Entity Weak Entity
Strong entities have either While weak entity always has total
total participation or not. participation.
Relationships in DBMS
A relationship is defined as an association among several entities.
40
Relationship Set
A set of relationships of similar type is called a relationship set. Like
entities, a relationship too can have attributes. These attributes are
called descriptive attributes.
Mapping Cardinalities:
express the number of entities to which another entity can be
associated via a relationship. For binary relationship sets between
entity sets A and B, the mapping cardinality must be one of:
Degree
Degree of a relationship set = Number of entity sets participating in a
relationship set
42
On the basis of degree of a relationship set, a relationship set can be
classified into the following types-
Participation Constraints
44
Additional Features of the ER Model in DBMS
As the complexity of data increased, it became more and more
difficult to use the traditional ER Model for database modelling.
Hence some Additional Features were made to the existing ER Model
to make it able to handle the complex applications better.
Generalization
Specialization
Aggregration
45
The subclass is said to inherit from superclass. When a subclass
inherits from one or more super classes, it inherits all their attributes.
In addition to the inherited attributes, a subclass can also define its
own specific attributes.
Generalization
Generalization is a process of extracting common properties from a
set of entities and creating a generalized entity from it. It is a bottom-
up approach, and it helps to reduce the size and complexity of the
schema.
Example: Let us take two low-level entities as Car and Bus, and these
two will have many common attributes and some specific attributes.
And We will generalize and link the common attributes to the newly
formed high-level entity named Vehicle.
Specialization
Specialization is opposite to Generalization. In this, entity is divided
into sub-entities bases on their characteristic’s(distinguishing
features). It breaks an entity into multiple entities from higher level to
lower level. It is a top down approach.
46
Aggregation
Aggregation refers to the process by which entities are combined to
form a single meaningful entity. The specific entities are combined
because they do not make sense on their own. To establish a single
entity, aggregation creates a relationship that combines these entities.
The resulting entity makes sense because it enables the system to
function well.
47