DBMS_IOT_1
DBMS_IOT_1
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.
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 are related to each other through primary and foreign keys.
NoSQL: Data is organized in the form of key-value pairs, documents, graphs, or column-
based. These are designed to handle large-scale, high-performance scenarios.
File System Approach
File based systems were an early attempt to computerize the manual system. It is also
called a traditional based approach in which a decentralized approach was taken where
each department stored and controlled its own data with the help of a data processing
specialist. The main role of a data processing specialist was to create the necessary
computer file structures, and also manage the data within structures and design some
application programs that create reports based on file data.
Consider an example of a student's file system. The student file will contain information
regarding the student (i.e. roll no, student name, course etc.). Similarly, we have a subject file
that contains information about the subject and the result file which contains the information
regarding the result.
Some fields are duplicated in more than one file, which leads to data redundancy. So to
overcome this problem, we need to create a centralized system, i.e. DBMS approach.
DBMS:
A database approach is a well-organized collection of data that are related in a
meaningful way which can be accessed by different users but stored only once in a
system. The various operations performed by the DBMS system are: Insertion,
deletion, selection, sorting etc.
Disadvantages of File System:
Redundancy of data: Data is said to be redundant if the same data is copied at many places.
If a student wants to change their Phone number, he or she has to get it updated in various
sections. Similarly, old records must be deleted from all sections representing that student.
Inconsistency of Data: Data is said to be inconsistent if multiple copies of the same data do
not match each other. If the Phone number is different in Accounts Section and Academics
Section, it will be inconsistent. Inconsistency may be because of typing errors or not
updating all copies of the same data.
Difficult Data Access: A user should know the exact location of the file to access data, so the
process is very cumbersome and tedious. If the user wants to search the student hostel
allotment number of a student from 10000 unsorted students’ records, how difficult it can
be.
Unauthorized Access: File Systems may lead to unauthorized access to data. If a student
gets access to a file having his marks, he can change it in an unauthorized way.
No Concurrent Access: The access of the same data by multiple users at the same time is
known as concurrency. The file system does not allow concurrency as data can be accessed
by only one user at a time.
No Backup and Recovery: The file system does not incorporate any backup and recovery of
data if a file is lost or corrupted.
Advantages of DBMS
Data organization: A DBMS allows for the organization and storage of data in a
structured manner, making it easy to retrieve and query the data as needed.
Data integrity: A DBMS provides mechanisms for enforcing data integrity constraints,
such as constraints on the values of data and access controls that restrict who can access
the data.
Data security: A DBMS provides tools for managing the security of the data, such as
controlling access to the data and encrypting sensitive data.
Backup and recovery: A DBMS provides mechanisms for backing up and recovering the
data in the event of a system failure.
Data sharing: A DBMS allows multiple users to access and share the same data, which
can be useful in a collaborative work environment.
Disadvantages of DBMS
Performance overhead: The use of a DBMS can add overhead to the performance of an
application, especially in cases where high levels of concurrency are required.
Scalability: The use of a DBMS can limit the scalability of an application, since it requires
the use of locking and other synchronization mechanisms to ensure data consistency.
Cost: The cost of purchasing, maintaining and upgrading a DBMS can be high, especially
for large or complex systems.
Limited Use Cases: Not all use cases are suitable for a DBMS, some solutions don’t need
high reliability, consistency or security and may be better served by other types of data
storage.
Basics File System DBMS
The file system is a way of
DBMS is software for managing
Structure arranging the files in a storage
the database.
medium within a computer.
Data
Redundant data can be present In DBMS there is no redundant
Redundan in a file system. data.
cy
Backup It doesn’t provide Inbuilt It provides in house tools for
and mechanism for backup and backup and recovery of data
recovery of data if it is lost. even if it is lost.
Recovery
Query
There is no efficient query Efficient query processing is there
processin processing in the file system. in DBMS.
g
There is more data consistency
Consisten There is less data consistency in
because of the process of
cy the file system.
normalization.
It has more complexity in
Complexit It is less complex as compared to
handling as compared to the file
y DBMS.
system.
Basics File System DBMS
It has a comparatively higher cost
Cost It is less expensive than DBMS.
than a file system.
Data In DBMS data independence
exists, mainly of two types:
Independe There is no data independence.
1) Logical Data Independence.
nce 2)Physical Data Independence.
User Only one user can access data at Multiple users can access data at a
Access a time. time.
The users are not required to write The user has to write procedures
Meaning procedures. for managing databases
Data is distributed in many files. Due to centralized nature data
Sharing So, it is not easy to share data. sharing is easy
Data
It give details of storage and It hides the internal details of
Abstractio representation of data Database
n
Integrity
Integrity Constraints are difficult to Integrity constraints are easy to
Constraint implement implement
s
To access data in a file , user
Application of DBMS:
There are different fields where a database management system is utilized. Following are a
few applications which utilize the information base administration framework –
Banking –
Database the executive’s framework is utilized to store the exchange data of the client in the
information base.
Education Sector –
Presently, assessments are led online by numerous schools and colleges. They deal with
all assessment information through the data set administration framework (DBMS). In
spite of that understudy’s enlistments subtleties, grades, courses, expense, participation,
results, and so forth all the data is put away in the information base.
Account –
The information base administration framework is utilized for putting away data about
deals, holding and acquisition of monetary instruments, for example, stocks and bonds
in a data set.
Online Shopping –
These days, web-based shopping has become a major pattern. Nobody needs to visit the
shop and burn through their time. Everybody needs to shop through web based
shopping sites, (for example, Amazon, Flipkart, Snapdeal) from home. So all the items
are sold and added uniquely with the assistance of the information base administration
framework (DBMS). Receipt charges, installments, buy data these are finished with the
assistance of DBMS.
Human Resource Management –
Big firms or organizations have numerous specialists or representatives working under
them. They store data about worker’s compensation, assessment, and work with the
assistance of an information base administration framework (DBMS).
Manufacturing –
Manufacturing organizations make various kinds of items and deal them consistently.
To keep the data about their items like bills, acquisition of the item, amount, inventory
network the executives, information base administration framework (DBMS) is
utilized.
Data retrieval: DBMS provides a way to retrieve data quickly and easily using search
queries.
Data manipulation: DBMS provides tools to manipulate data, such as sorting, filtering,
and aggregating data.
Security: DBMS provides security features to ensure that only authorized users have
access to the data.
Data backup and recovery: DBMS provides tools to back up data and recover it in case
of system failures or data loss.
Multi-user access: DBMS allows multiple users to access and modify data
simultaneously.
Reporting and analysis: DBMS provides tools to generate reports and analyze data to
gain insights and make informed decisions.
Database Languages
CREATE: to create a database and its objects like (table, index, views, store procedure,
function, and triggers)
TRUNCATE: remove all records from a table, including all spaces allocated for the
records are removed
GRANT: grant permissions to the user for running DML(SELECT, INSERT, DELETE,…)
commands on the table
REVOKE: revoke permissions to the user for running DML(SELECT, INSERT, DELETE,…)
command on the specified table
Transactional Control Language
TCL is short for Transactional Control Language which acts as an manager for all types of
transactional data and all transactions.Some of the command of TCL are
Save Point: It is used to save the data on the temporary basis in the database
DBMS Architecture:DBMS architecture is depending on
its design and can be of the following types:
1)Centralized
2)Decentralized
3)Hierarchical
One tier architecture:
One tier architecture has all the layers such as Presentation, Business, Data
Access layers in a single software package. Applications which handles all the three
tiers such as MP3 player, MS Office are come under one tier application. The data is
stored in the local system or a shared drive.
Two-Tier Architecture:
1. Client Application (Client Tier)
2. Database (Data Tier)
Client system handles both Presentation and Application layers and Server system
handles Database layer. It is also known as client server application. The
communication takes place between the Client and the Server. Client system sends
the request to the Server system and the Server system processes the request and
sends back the data to the Client System
Three-tier architecture :is divided into three parts:
1. Presentation layer (Client Tier)
2. Application layer (Business Tier)
3. Database layer (Data Tier)
Database Models:
A Database model defines the logical design and structure of a database and
defines how data will be stored, accessed and updated in a database
management system.
While the Relational Model is the most widely used database model,
2)The data model should be detailed enough to be used for building the
physical database.
3)The information in the data model can be used for defining the
relationship between tables, primary and foreign keys, and stored
procedures.
The hierarchy starts from the Root data, and expands like a tree, adding child
nodes to the parent nodes.
In this model, a child node will only have a single parent node.
Network Model
relationships are created by dividing object of interest into entity and its
characteristics into attributes.
E-R Models are defined to represent the relationships into pictorial form to
make it easier for different stakeholders to understand.
Relational Model
Data is organised in two-dimensional tables and the relationship is maintained by
storing a common field.
This model was introduced by E.F Codd in 1970, and since then it has been the
most widely used database model, infact, we can say the only database model
used around the world.
The basic structure of data in the relational model is tables. All the information
related to a particular type is stored in rows of that table.
Describes the structure of a database with the help of a diagram, which is known
as Entity Relationship Diagram (ER Diagram). An ER model is a design or blueprint of a
database that can later be implemented as a database.
Student
Weak Entity:
An entity that cannot be uniquely identified by its own attributes and relies on the
relationship with other entity is called weak entity. The weak entity is represented
by a double rectangle. For example – a bank account cannot be uniquely identified
without knowing the bank to which the account belongs, so bank account is a weak
entity.
Attribute(s):
Attributes are the properties which define the entity type. For example, Roll_No,
Name, DOB, Age, Address, Mobile_No are the attributes which defines entity type
Student. In ER diagram, attribute is represented by an oval.
1)Key Attribute –
The attribute which uniquely identifies each entity in the entity set is called key
attribute.For example, Roll_No will be unique for each student. In ER diagram, key
attribute is represented by an oval with underlying lines.
Composite Attribute –
An attribute composed of many other attribute is called as composite attribute. For
example, Address attribute of student Entity type consists of Street, City, State, and
Country. In ER diagram, composite attribute is represented by an oval comprising of
ovals.
Multivalued Attribute –
An attribute consisting more than one value for a given entity. For example,
Phone_No (can be more than one for a given student). In ER diagram,
multivalued attribute is represented by double oval.
Derived Attribute –
An attribute which can be derived from other attributes of the entity type is known
as derived attribute. e.g.; Age (can be derived from DOB). In ER diagram, derived
attribute is represented by dashed oval.
The complete entity type Student with its attributes can be represented as:
Relationship:
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.
Degree of Relationship
The number of participating entities in a relationship defines the degree of
the relationship.
1)Binary = degree 2
2)Ternary = degree 3
3)n-ary = degree
Mapping Cardinalities:
Cardinality defines the number of entities in one entity set, which can be
associated with the number of entities of other set via relationship set.
One-to-one − One entity from entity set A can be associated with at most one
entity of entity set B and vice versa.
One-to-many −:
One entity from entity set A can be associated with more than one entities of
entity set B however an entity from entity set B, can be associated with at most
one entity.
Many-to-many :
One entity from A can be associated with more than one entity from
B and vice versa.
Relationship
Relationships are represented by diamond-shaped box. Name of the relationship is written
inside the diamond-box. All the entities (rectangles) participating in a relationship, are
connected to it by a line.
One-to-one − When only one instance of an entity is associated with the relationship, it is
marked as '1:1'. The following image reflects that only one instance of each entity should be
associated with the relationship. It depicts one-to-one relationship.
One-to-many −:
When more than one instance of an entity is associated with a relationship, it is marked
as '1:N'. The following image reflects that only one instance of entity on the left and
more than one instance of an entity on the right can be associated with the relationship.
It depicts one-to-many relationship.
Many-to-many −:
The following image reflects that more than one instance of an entity on the left and
more than one instance of an entity on the right can be associated with the relationship.
It depicts many-to-many relationship.
Participation Constraints:
Partial participation − Not all entities are involved in the relationship. Partial
participation is represented by single lines.
Keys: Keys play an important role in the relational database.
It is used to uniquely identify any record or row of data from the table. It is also
used to establish and identify relationships between tables.
Types of
key:
1) Primary key:
It is the first key which is used to identify one and only one instance of an
entity uniquely. An entity can contain multiple keys as we saw in PERSON
table. The key which is most suitable from those lists become a primary
key.
2. Candidate key:
A candidate key is an attribute or set of an attribute which can uniquely
identify a tuple.
The remaining attributes except for primary key are considered as a candidate
key. The candidate keys are as strong as the primary key.
3. Super Key
Super key is a set of an attribute which can uniquely identify a tuple. Super key is a
superset of a candidate key.
4.Foreign key:
• Foreign keys are the column of the table which is used to point to the primary key of another table.
• In a company, every employee works in a specific department, and employee and department are
two different entities. So we can't store the information of the department in the employee table.
That's why we link these two tables through the primary key of one table.
• We add the primary key of the DEPARTMENT table, Department_Id as a new attribute in the
EMPLOYEE table.
• Now in the EMPLOYEE table, Department_Id is the foreign key, and both the tables are related.
Dr Edgar F. Codd, after his extensive research on the Relational Model of database
systems, came up with twelve rules of his own, which according to him, a database
must obey in order to be regarded as a true relational database.
These rules can be applied on any database system that manages stored data using
only its relational capabilities. This is a foundation rule, which acts as a base for all the
other rules.
1)Specialization
2)Generalization
3)Aggregation
Generalization
Generalization is like a bottom-up approach in which two or more entities of lower level
combine to form a higher level entity if they have some attributes in common.
In generalization, an entity of a higher level can also combine with the entities of the lower
level to form a further higher level entity.
Generalization is more like subclass and superclass system, but the only difference is the
approach. Generalization uses the bottom-up approach.
In generalization, entities are combined to form a more generalized entity, i.e., subclasses
are combined to make a superclass.
Specialization
Specialization is a top-down approach, and it is opposite to Generalization. In
specialization, one higher level entity can be broken down into two lower level
entities.
Specialization is used to identify the subset of an entity set that shares some
distinguishing characteristics.
Normally, the super class is defined first, the subclass and its related attributes are
defined next, and relationship set are then added.
Aggregation
In aggregation, the relation between two entities is treated as a single entity. In
aggregation, relationship with its corresponding entities is aggregated into a higher level
entity.