Dbms Notes
Dbms Notes
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.
In the late 1960s, The first general-purpose DBMS, designed by Charles Bachman,
was called the Integrated Data Store (IDS) which was based on network data model
for which he was received the Turing Award (The most prestigious award which is
equivalent to Nobel prize in the field of Computer Science.).
In the late 1970s, Mr Edgar Codd proposed a new data representation framework
called the Relational Database Model. Mr Edgar Codd won the 1981 Turing Award for
his seminal work. This model was based on the concept of a table, with rows
representing individual records and columns representing individual fields within those
records. The relational model allowed for more efficient storage and retrieval of data
and was easier to use than the hierarchical or navigational models.
In the late 1980s IBM developed the Structured Query Language (SQL) for relational
databases, as a part of R project. This system was designed to manage large amounts
of data and was used primarily in corporate and government applications. SQL was
adopted by the American National Standards Institute (ANSI) and International
Organization for Standardization (ISO).
In the 1980s, several new DBMS products were introduced, including Oracle, Sybase,
and Microsoft SQL Server. These systems were designed to be more user-friendly and
to support more advanced data modeling and query languages.
In the 1990s, object-oriented DBMS (OODBMS) emerged, which were designed to
store and manage complexdata structures, such as multimedia and other types of non-
traditional data. These systems were initially popular in research and academic
environments, but their adoption was limited in the commercial sector.
In the 1991, Microsoft ships MS access, a personal DBMS and that displaces all other
personal DBMS products.
In the 1997, XML applied to database processing. Many vendors begin to integrate XML
into DBMS products.
In the 2000s, web-based applications and cloud computing became more popular, and
DBMS systems began to adapt to these new technologies. New DBMS systems were
developed to support distributed and web-based applications, including NoSQL
databases such as MongoDB and Cassandra.
Today, DBMS systems continue to evolve, with an emphasis on scalability,
performance, and support for cloud-based applications. Some of the most popular
DBMS systems in use today include Oracle, Microsoft SQL Server, MySQL,
PostgreSQL, and MongoDB.
What is DBMS?
Database Management System (DBMS) is a software for storing and retrieving user’s
data while considering appropriate security measures. It consists of a group of
programs that manipulate the database. The DBMS accepts the request for data from
an application and instructs the DBMS engine to provide the specific data. In large
systems, a DBMS helps users and other third-party software to store and retrieve data.
A file system is a software that manages and organizes the files in a storage DBMS or Database Management System
medium. It controls how data is stored and retrieved. for accessing, creating, and managing dat
The file system provides the details of data representation and storage of data. DBMS gives an abstract view of data that
Storing and retrieving of data can’t be done efficiently in a file system. DBMS is efficient to use as there are a wi
retrieve data.
File System Database systems
Conventional file systems are used where there is less demand for security Database systems are used when securit
constraints(Security is very low). high).
File systems define the data in un-structured manner. Data is usually in isolated Database systems define the data in a str
form. defined co-relation among the data.
Data inconsistency is more in file systems. Data inconsistency is less in database sys
User locates the physical address of file to access the data in conventional file User is unknown to the physical address
systems. systems.
There is no ability to concurrently access the data using conventional file system. There is ability to access the data concurr
Not provide support for complicated transactions. Easy to implement complicated transacti
It doesn’t offer backup and recovery of data if it is lost. DBMS system provides backup and recov
Each application has its data file so, the same data may have to be recorded and stored
many times.
Data dependence in the file processing system are data-dependent, but, the problem is
incompatible with file format.
Limited data sharing.
The problem with security.
Time-consuming.
It allows you to maintain the record of the big firm having a large number of items.
Required lots of labor work to do.
Advantages of DBMS system
Data Models
A data model is a collection of high-level data description constructs that hide many low-
level storage details. A DBMS allows a user to define the data to be stored in terms of a
data model.
The data models can be classified into different categories:
1. Hierarchical Model
2. Network Model
3. Entity-Relationship Model
4. Relational Model
5. Object-Based Data Model
6. Semi-structured Data model
1. 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. This model easily represents some of the
real-world relationships like food recipes, sitemap of a website etc.
Depicts a set of one-to-many (1:M) relationships
2. Network Model
This model is an extension of the hierarchical model, the only difference is that a record
can have more than one parent. It replaces the hierarchical tree with a graph.
The network model was created to represent complex data relationships more
effectively when compared to hierarchical models, to improve database performance
and standards.
Depicts both one-to-many (1:M) and many-to-many (M:N) relationships.
3. Entity-Relationship 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.
1. Entities − It is a real-world thing which can be a person, place, or even a concept. For
Example: Department, Admin, Courses, Teachers, Students, Building, etc are some of
the entities of a School Management System.
2. Attributes − An entity which contains a real-world property called an attribute. For
Example: The entity employee has the property like employee id, salary, age, etc.
3. Relationship − Relationship tells how two attributes are related. For Example:
Employee works for a department.
An entity has a real-world property called attribute and these attributes are defined by a
set of values called domain.
Advantages of Entity-Relationship Model
4. Relational Model
The relational model uses a collection of tables to represent both data and the
relationships. Tables are also known as relations. Each table has multiple columns
represent as attributes, Attributes are the properties which define a relation. Each row of
the table represents as Tuple, Tuple is one piece of information.
Terminologies used in Realation Model
Tables: relations are saved in the table format. A table has two properties rows and
columns
Attribute: columns represent as attributes
Tuple: A Row represent as Tuple
Relation Schema: A relation schema represents the name of the relation with its
attributes.
Degree: The total number of attributes which in the relation is called the degree of the
relation.
Cardinality: Total number of rows present in the Table.
Column: The column represents the set of values for a specific attribute.
Relation instance: The set of tuples of a relation at a particular instance of time is
called as relation instance.
Relational model requires powerful hardware and large data storage devices.
May lead to slower processing time.
Poorly designed systems lead to poor implementation of database systems.
Reduced Maintenance
Real-World Modeling
Improved Reliability and Flexibility
High Code Reusability
Data Abstraction is a process of hiding unwanted or irrelevant details from the end user.
It provides a different view and helps in achieving data independence which is used to
enhance the security of data.
The database systems consist of complicated data structures and relations. For users to
access the data easily, these complications are kept hidden, and only the relevant part
of the database is made accessible to the users through data abstraction.
An external level is only related to the data which is viewed by specific end users.
This level includes some external schemas.
External schema level is nearest to the user
An external schema is also known as view schema.
Each view schema describes the database part that a particular user group is interested
and hides the remaining database from that user group.
The view schema describes the end user interaction with database systems.
Structure of DBMS
DDL interpreter: This is basically a translator which interprets the DDL statements in
data dictionaries.
DML compiler: It translates DML statements query language into an evaluation plan.
This plan consists of the instructions which query evaluation engine understands.
Query evaluation engine: It executes the low-level instructions generated by the DML
compiler.
When a user issues a query, the parsed query is presented to a query optimizer, which
uses information about how the data is stored to produce an efficient execution plan for
evaluating the query. An execution plan is a blueprint for evaluating a query. It is
evaluated by query evaluation engine.
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.
The storage manager is responsible for storing, retrieving, and updating data in the
database. The storage manager components include
Authorization and integrity manager: Validates the users who want to access the data
and tests for integrity constraints.
Transaction manager: Ensures that the database remains in consistent despite of
system failures and concurrent transaction execution proceeds without conflicting.
File manager: Manages allocation of space on disk storage and representation of the
information on disk.
Buffer manager: Manages the fetching of data from disk storage into main memory.
The buffer manager also decides what data to cache in main memory. Buffer manager is
a crucial part of database system.
Storage manager implements several data structures such as
1. Requirement analysis
2. Conceptual database design
3. Logical database design
4. Schema refinement
5. Physical database design
6. Application and security design
1. Requirement analysis
It is necessary to understand what data need to be stored in the database,
what applications must be built, what are all those operations that are frequently
used by the system.
The requirement analysis is an informal process and it requires proper
communication with user groups.
There are several methods for organizing and presenting information gathered in
this step. Some automated tools can also be used for this purpose.
4. Schema refinement
In this step, relational database schema is analyzed to identify the potential
problems and to refine it.
The schema refinement can be done with the help of normalizing and
restructuring the relations.
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.
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).
E-R diagrams provide the purpose of real-world modeling of objects which makes them
intently useful.
E-R diagrams require no technical knowledge and no hardware support.
These diagrams are very easy to understand and easy to create even by a naive user.
It gives a standard solution of visualizing the data logically.
1. Entities − It is a real-world thing which can be a person, place, or even a concept. For
Example: Department, Admin, Courses, Teachers, Students, Building, etc are some of
the entities of a School Management System.
2. Attributes − An entity which contains a real-world property called an attribute. For
Example: The entity employee has the property like employee id, salary, age, etc.
3. Relationship − Relationship tells how two attributes are related. For Example:
Employee works for a department.
Component Symbol
Entity
Weak Entity
Attribute
Component Symbol
Key Attribute
Composite Attribute
Multivalued Attribute
Derived Attribute
Relationship
Component Symbol
Weak Relationship
Participation Constraints
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.
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.
Simple Vs. Composite Attributes
The attribute which cannot further split into its components is a simple The file system provides the details of data
attribute. data.
Simple Attribute Composite Attribute
Example: The marks of a student, the age of an employee etc. Example: Name of the student can split int
The attribute which has a single value for each entity instance is known as single- The attribute which takes up more t
valued attribute. There is no alternative of this value. instance is known as multi valued att
Example: The RollNo, DOB, Gender of a student will always be a single value. Example: A person know more than
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.
Stored Vs. Derived Attributes
An attribute which cannot derive from other attributes and it is An attribute which is determine the value from other a
mandatory to be stored in the database. it is not mandatory to be stored in the database.
Stored Attribute Derived Attributes
Example: The value which is fixed like Date of Birth. Example: Age of student can be derived from DOB.
6. Key Attributes:
Key attributes are those attributes which can identify an entity uniquely in an entity set.
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.
Student Entity with all types of Attributes
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.
Entity type: The entity type is a collection of the entity having similar attributes.
Entity set: is a group of entities of similar kinds. It can contain entities with attributes
that share similar values. It's collectively a group of entities of a similar type. The entity
set need not be disjoint.
In summary, an Entity is an object of a Type Entity and the set of all entities is called an
entity set.
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.
Strong Entity v/s Weak Entity
Strong entity always has a primary key. While a weak entity has a partial discriminator key.
Strong entity is not dependent on any other entity. Weak entity depends on strong entity.
Strong entity is represented by a single rectangle. Weak entity is represented by a double rectangle.
Two strong entity’s relationship is represented by a single While the relation between one strong and one weak enti
diamond. diamond.
Strong entities have either total participation or not. While weak entity always has total participation.
Relationships in DBMS
Definition
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:
One-to-one: An entity in A is associated with at most one entity in B, and an entity in B
is associated with at most one entity in A.
The appropriate mapping cardinality for a particular relationship set depends on the real
world being modeled.
Participation Constraints
Total Participation of an Entity set
Total participation of an entity set represents that each entity in entity set must have at
least one relationship in a relationship set. It is also called mandatory participation. Total
participation is represented using a double line between the entity set and relationship
set.
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.
Hence, Three new concepts were added to the existing ER Model, they were:
Generalization
Specialization
Aggregration
Some entities have relationships that form hierarchies. For instance, Employee can be
an hourly employee or contracted employee.
In this relationship hierarchies, some entities can act as superclass and some other
entities can act as subclass.
Superclass: An entity type that represents a general concept at a high level, is called
superclass.
Subclass: An entity type that represents a specific concept at lower levels, is called
subclass.
The subclass is said to inherit from superclass. When a subclass inherits from one or
more superclasses, it inherits all their attributes. In addition to the inherited attributes, a
subclass can also define its own specific attributes.
The symbol used for specialization/ Generalization is
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 subentities
bases on their charactertics(distingvishing features). It breaks an entity into multiple
entities from higher level to lower level. It is a top down approach.
Aggregration
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.
Tables: relations are saved in the table format. A table has two properties rows and
columns
Attribute: columns represent as attributes
Tuple: A Row represent as Tuple
Relation Schema: A relation schema represents the name of the relation with its
attributes.
Degree: The total number of attributes which in the relation is called the degree of the
relation.
Cardinality: Total number of rows present in the Table.
Column: The column represents the set of values for a specific attribute.
Relation instance: The set of tuples of a relation at a particular instance of time is
called as relation instance.
Advantages of Realation Model
Relational model requires powerful hardware and large data storage devices.
May lead to slower processing time.
Poorly designed systems lead to poor implementation of database systems.