Dbms Mod1
Dbms Mod1
MODULE 1
● Introduction of DBMS
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.
Key Features of DBMS
2. Data modeling: A DBMS provides tools for creating and modifying data models, which
define the structure and relationships of the data in a database.
3. 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.
4. 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.
5. 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.
6. Backup and recovery: A DBMS provides mechanisms for backing up and recovering the
data in the event of a system failure.
7. DBMS can be classified into two types: Relational Database Management System
(RDBMS) and Non-Relational Database Management System (NoSQL or Non-SQL)
8. 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.
9. 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.
10. A database is a collection of interrelated data which helps in the efficient retrieval,
insertion, and deletion of data from the database and organizes the data in the form of
tables, views, schemas, reports, etc. For Example, a university database organizes the
data about students, faculty, admin staff, etc. which helps in the efficient retrieval,
insertion, and deletion of data from it.
● Need of DBMS
A Data Base Management System is a system software for easy, efficient and reliable data
processing and management. It can be used for:
● Creation of a database.
● Retrieval of information from the database.
● Updating the database.
● Managing a database.
● Multiple User Interface
● Data scalability, expandability and flexibility: We can change schema of the
database, all schema will be updated according to it.
● Overall the time for developing an application is reduced.
● Security: Simplifies data storage as it is possible to assign security permissions
allowing restricted access to data.
Data organization: DBMS allow users to organize large amounts of data in a structured and
systematic way. Data is organized into tables, fields, and records, making it easy to manage,
store, and retrieve information.
Data scalability: DBMS are designed to handle large amounts of data and are scalable to meet
the growing needs of organizations. As organizations grow, DBMS can scale up to handle
increasing amounts of data and user traffic.1.Data Organization and Management
2.Data Security and Privacy
3.Data Integrity and Consistency
4.Concurrent Data Access
5.Data Analysis and Reporting
6.Scalability and Flexibility
7.Cost-Effectiveness
1. Data Organization and Management:
One of the primary needs for a DBMS is data organization and management. DBMSs allow data
to be stored in a structured manner, which helps in easier retrieval and analysis. A
well-designed database schema enables faster access to information, reducing the time
required to find relevant data. A DBMS also provides features like indexing and searching,
which make it easier to locate specific data within the database. This allows organizations to
manage their data more efficiently and effectively.
2. Data Security and Privacy:
DBMSs provide a robust security framework that ensures the confidentiality, integrity, and
availability of data. They offer authentication and authorization features that control access to
the database. DBMSs also provide encryption capabilities to protect sensitive data from
unauthorized access. Moreover, DBMSs comply with various data privacy regulations such as
the GDPR, HIPAA, and CCPA, ensuring that organizations can store and manage their data in
compliance with legal requirements.
3. Data Integrity and Consistency:
Data integrity and consistency are crucial for any database. DBMSs provide mechanisms that
ensure the accuracy and consistency of data. These mechanisms include constraints, triggers,
and stored procedures that enforce data integrity rules. DBMSs also provide features like
transactions that ensure that data changes are atomic, consistent, isolated, and durable (ACID).
4. Concurrent Data Access:
A DBMS provides a concurrent access mechanism that allows multiple users to access the
same data simultaneously. This is especially important for organizations that require real-time
data access. DBMSs use locking mechanisms to ensure that multiple users can access the
same data without causing conflicts or data corruption.
5. Data Analysis and Reporting:
DBMSs provide tools that enable data analysis and reporting. These tools allow organizations to
extract useful insights from their data, enabling better decision-making. DBMSs support various
data analysis techniques such as OLAP, data mining, and machine learning. Moreover, DBMSs
provide features like data visualization and reporting, which enable organizations to present
their data in a visually appealing and understandable way.
6. Scalability and Flexibility:
DBMSs provide scalability and flexibility, enabling organizations to handle increasing amounts of
data. DBMSs can be scaled horizontally by adding more servers or vertically by increasing the
capacity of existing servers. This makes it easier for organizations to handle large amounts of
data without compromising performance. Moreover, DBMSs provide flexibility in terms of data
modeling, enabling organizations to adapt their databases to changing business requirements.
7. Cost-Effectiveness:
DBMSs are cost-effective compared to traditional file-based systems. They reduce storage
costs by eliminating redundancy and optimizing data storage. They also reduce development
costs by providing tools for database design, maintenance, and administration. Moreover,
DBMSs reduce operational costs by automating routine tasks and providing self-tuning
capabilities.
managing the
database.
storage of data.
data.
some information
or updating some
information.
lead to
inconsistency.
○ Logical Data
Independence
○ Physical Data
Independence
implement in file
system.
○ Hierarchal data
models
○ Network data
models
○ Relational data
models
database approach.
Sybase etc.
● Database Administrator
A database administrator (DBA) is a person or group in charge of implementing
DBMS in an organization. The DBA job requires a high degree of technical
expertise. DBA consists of a team of people rather than just one person.
Database design
Performance issues
Database accessibility
Capacity issues
Data replication
Table Maintenance
Responsibilities of DBA
The responsibilities of DBA are as follows −
● Database designing.
● Knowledge of Structured Query Language (SQL).
● Know about distributed architecture.
● Knowledge on different operating servers.
● Idea on Relational Database Management System (RDBMS).
● Ready to face challenges and solve the problems quickly.
● Function of DBA
Above ans.
● Database Architecture
❖ Level of abstraction or 3 tier architecture
Physical/internal level
Conceptual/logical level
External/view level
DBMS Architecture
○ The DBMS design depends upon its architecture. The basic client/server
architecture is used to deal with a large number of PCs, web servers, database
servers and other components that are connected with networks.
○ The client/server architecture consists of many PCs and a workstation which are
connected via the network.
○ DBMS architecture depends upon how users are connected to the database to
get their request done.
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 user interfaces and application programs are run on the client-side.
○ The server side is responsible to provide the functionalities like: query processing
and transaction management.
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.
○ 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.
○ If we do any changes in the conceptual view of the data, then the user view of the
data would not be affected.
○ 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.
Schema is further divided into three types. These three are as follows.
1. Logical schema.
2. View schema.
3. Physical schema.
The schema defines the logical view of the database. It provides some knowledge about
the database and what data needs to go where.
We can understand the relationship between the data present in the database. With the
help of this schema, we can implement the DBMS function such as delete, insert,
search, update, etc.
Let us understand this by the below diagram. There are three diagrams, i.e., section,
course, and student. This diagram shows the relationship between the section and the
course diagram. Schema is the only type of structural view of the database that is
shown below.
1. Physical schema:
In the physical schema, the database is designed at the physical level. At this level, the
schema describes how the data block is stored and how the storage is managed.
2. Logical schema:
In the logical schema, the database is designed at a logical level. At this level, the
programmer and data administrator perform their work. Also, at this level, a certain
amount of data is stored in a structured way. But the internal implementation data are
hidden in the physical layer for the security proposed.
3. View schema:
In view schema, the database is designed at the view level. This schema describes the
user interaction with the database system.
Moreover, Data Definition Language (DDL) statements help to denote the schema of a
database. The schema represents the name of the table, the name of attributes, and
their types; constraints of the tables are related to the schema. Therefore, if users want
to modify the schema, they can write DDL statements.
For example, in the above example, we have taken the example of the attribute of the
schema. In this example, each table contains two rows or two records. In the above
schema of the table, the employee table has some instances because all the data
stored by the table have some instances.
Let's take another example: Let's say we have a single table student in the database;
today, the table has 100 records, so today, the instance of the database has 100
records. We are going to add another 100 records to this table by tomorrow, so the
instance of the database tomorrow will have 200 records in the table. In short, at a
particular moment, the data stored in the database is called the instance; this change
over time as and when we add, delete or update data in the database.
frequently.
● View of Data
Same as data abstraction
● Data abstraction
The database system contains intricate data structures and relations. The developers
keep away the complex data from the user and remove the complications so that the
user can comfortably access data in the database and can only access the data they
want, which is done with the help of data abstraction.
The main purpose of data abstraction is to hide irrelevant data and provide an abstract
view of the data. With the help of data abstraction, developers hide irrelevant data from
the user and provide them the relevant data. By doing this, users can access the data
without any hassle, and the system will also work efficiently.
In DBMS, data abstraction is performed in layers which means there are levels of data
abstraction in DBMS that we will further study in this article. Based on these levels, the
database management system is designed.
Data Administrators (DBA) decide how to arrange data and where to store data. The
Data Administrator (DBA) is the person whose role is to manage the data in the
database at the physical or internal level. There is a data center that securely stores the
raw data in detail on hard drives at this level.
The logical or conceptual level is the intermediate or next level of data abstraction. It
explains what data is going to be stored in the database and what the relationship is
between them.
It describes the structure of the entire data in the form of tables. The logical level or
conceptual level is less complex than the physical level. With the help of the logical
level, Data Administrators (DBA) abstract data from raw data present at the physical
level.
View or External Level is the highest level of data abstraction. There are different views
at this level that define the parts of the overall data of the database. This level is for the
end-user interaction; at this level, end users can access the data based on their queries.
● Database Languages
❖ DML
❖ DDL
❖ DCL(not in ppt)
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.
○ DDL stands for Data Definition Language. It is used to define database structure
or pattern.
○ It is used to create schema, tables, indexes, constraints, etc. in the database.
○ Using the DDL statements, you can create the skeleton of the database.
○ Data definition language is used to store the information of metadata like the
number of tables and schemas, their names, indexes, columns in each table,
constraints, etc.
These commands are used to update the database schema that's why they come under
Data definition language.
○ DCL stands for Data Control Language. It is used to retrieve the stored or saved
data.
(But in Oracle database, the execution of data control language does not have the
feature of rolling back.)
There are the following operations which have the authorization of Revoke:
● Rollback: It is used to restore the database to original since the last Commit.
● Domain Constraints
Integrity Constraints
○ Integrity constraints are a set of rules. It is used to maintain the quality of
information.
○ Integrity constraints ensure that the data insertion, updating, and other processes
have to be performed in such a way that data integrity is not affected.
1. Domain constraints
○ Domain constraints can be defined as the definition of a valid set of values for an
attribute.
○ The data type of domain includes string, character, integer, time, date, currency,
etc. The value of the attribute must be available in the corresponding domain.
Example:
○ The entity integrity constraint states that primary key value can't be null.
○ This is because the primary key value is used to identify individual rows in
relation and if the primary key has a null value, then we can't identify those rows.
○ A table can contain a null value other than the primary key field.
Example:
3. Referential Integrity Constraints
Example:
4. Key constraints
○ Keys are the entity set that is used to identify an entity within its entity set
uniquely.
○ An entity set can have multiple keys, but out of which one key will be the primary
key. A primary key can contain a unique and null value in the relational table.
Example:
● Referral Integrity
Above ans
● Assertions
When a constraint involves 2 (or) more tables, the table constraint mechanism is sometimes
hard and results may not come as expected. To cover such situation SQL supports the creation
of assertions that are constraints not associated with only one table. And an assertion statement
should ensure a certain condition will always exist in the database. DBMS always checks the
assertion whenever modifications are done in the corresponding table.
Examples –
Examples- CHECK
14. constraints, FOREIGN KEY
AFTER INSERT triggers, INSTEAD
constraints
OF triggers
● Authorization
Authentication
User authentication is to make sure that the person accessing the database is
who he claims to be. Authentication can be done at the operating system level
or even the database level itself. Many authentication systems such as retina
scanners or bio-metrics are used to make sure unauthorized people cannot
access the database.
Authorization
Authorization is a privilege provided by the Database Administer. Users of the
database can only view the contents they are authorized to view. The rest of the
database is out of bounds to them.
● Data Models
❖ Relational model
The relational model represents how data is stored in Relational Databases. A relational
database consists of a collection of tables, each of which is assigned a unique name. Consider
a relation STUDENT with attributes ROLL_NO, NAME, ADDRESS, PHONE, and AGE shown in
the table.
Table Student
4 SURESH DELHI 18
Important Terminologies
● Attribute: Attributes are the properties that define an entity. e.g.; ROLL_NO, NAME,
ADDRESS
● Relation Schema: A relation schema defines the structure of the relation and represents
the name of the relation with its attributes. e.g.; STUDENT (ROLL_NO, NAME,
ADDRESS, PHONE, and AGE) is the relation schema for STUDENT. If a schema has
more than 1 relation, it is called Relational Schema.
● Tuple: Each row in the relation is known as a tuple. The above relation contains 4 tuples,
one of which is shown as:
● Relation Instance: The set of tuples of a relation at a particular instance of time is called
a relation instance. Table 1 shows the relation instance of STUDENT at a particular time.
It can change whenever there is an insertion, deletion, or update in the database.
● Degree: The number of attributes in the relation is known as the degree of the relation.
The STUDENT relation defined above has degree 5.
● Cardinality: The number of tuples in a relation is known as cardinality. The STUDENT
relation defined above has cardinality 4.
● Column: The column represents the set of values for a particular attribute. The column
ROLL_NO is extracted from the relation STUDENT.
ROLL_NO
3
4
● NULL Values: The value which is not known or unavailable is called a NULL value. It is
represented by blank space. e.g.; PHONE of STUDENT having ROLL_NO 4 is NULL.
● Relation Key: These are basically the keys that are used to identify the rows uniquely or
also help in identifying tables. These are of the following types.
● Primary Key
● Candidate Key
● Super Key
● Foreign Key
● Alternate Key
● Composite Key
Domain Constraints
These are attribute-level constraints. An attribute can only take values that lie inside the domain
range. e.g.; If a constraint AGE>0 is applied to STUDENT relation, inserting a negative value of
AGE will result in failure.
Key Integrity
Every relation in the database should have at least one set of attributes that defines a tuple
uniquely. Those set of attributes is called keys. e.g.; ROLL_NO in STUDENT is key. No two
students can have the same roll number. So a key has two properties:
● It should be unique for all tuples.
● It can’t have NULL values.
Referential Integrity
When one attribute of a relation can only take values from another attribute of the same relation
or any other relation, it is called referential integrity. Let us suppose we have 2 relations
Table Student
4 SURESH DELHI 18 IT
Table Branch
BRANCH_CODE BRANCH_NAME
CS COMPUTER SCIENCE
IT INFORMATION TECHNOLOGY
CV CIVIL ENGINEERING
BRANCH_CODE of STUDENT can only take the values which are present in BRANCH_CODE
of BRANCH which is called referential integrity constraint. The relation which is referencing
another relation is called REFERENCING RELATION (STUDENT in this case) and the relation
to which other relations refer is called REFERENCED RELATION (BRANCH in this case).
On Delete Cascade
It will delete the tuples from REFERENCING RELATION if the value used by REFERENCING
ATTRIBUTE is deleted from REFERENCED RELATION. e.g.; For, if we delete a row from
BRANCH with BRANCH_CODE ‘CS’, the rows in STUDENT relation with BRANCH_CODE CS
(ROLL_NO 1 and 2 in this case) will be deleted.
On Update Cascade
It will update the REFERENCING ATTRIBUTE in REFERENCING RELATION if the attribute
value used by REFERENCING ATTRIBUTE is updated in REFERENCED RELATION. e.g;, if
we update a row from BRANCH with BRANCH_CODE ‘CS’ to ‘CSE’, the rows in STUDENT
relation with BRANCH_CODE CS (ROLL_NO 1 and 2 in this case) will be updated with
BRANCH_CODE ‘CSE’.
Super Keys
Any set of attributes that allows us to identify unique rows (tuples) in a given relationship is
known as super keys. Out of these super keys, we can always choose a proper subset among
these that can be used as a primary key. Such keys are known as Candidate keys. If there is a
combination of two or more attributes that are being used as the primary key then we call it a
Composite key.
❖ ER model
❖ ER model stands for an Entity-Relationship model. It is a high-level data
model. This model is used to define the data elements and relationship for
a specified system.
For example, Suppose we design a school database. In this database, the student will
be an entity with attributes like address, name, id, age, etc. The address can be another
entity with attributes like city, street name, pin code, etc and there will be a relationship
between them.
Component of ER Diagram
1. Entity:
An entity may be any object, class, person or place. In the ER diagram, an entity can be
represented as rectangles.
An entity that depends on another entity called a weak entity. The weak entity doesn't
contain any key attribute of its own. The weak entity is represented by a double
rectangle.
2. Attribute
The attribute is used to describe the property of an entity. Eclipse is used to represent
an attribute.
For example, id, age, contact number, name, etc. can be attributes of a student.
a. Key Attribute
The key attribute is used to represent the main characteristics of an entity. It represents
a primary key. The key attribute is represented by an ellipse with the text underlined.
b. Composite Attribute
c. Multivalued Attribute
An attribute can have more than one value. These attributes are known as a multivalued
attribute. The double oval is used to represent multivalued attribute.
For example, a student can have more than one phone number.
d. Derived Attribute
An attribute that can be derived from other attribute is known as a derived attribute. It
can be represented by a dashed ellipse.
For example, A person's age changes over time and can be derived from another
attribute like Date of birth.
3. Relationship
a. One-to-One Relationship
When only one instance of an entity is associated with the relationship, then it is known
as one to one relationship.
For example, A female can marry to one male, and a male can marry to one female.
b. One-to-many relationship
When only one instance of the entity on the left, and more than one instance of an entity
on the right associates with the relationship then this is known as a one-to-many
relationship.
For example, Scientist can invent many inventions, but the invention is done by the only
specific scientist.
c. Many-to-one relationship
When more than one instance of the entity on the left, and only one instance of an entity
on the right associates with the relationship then it is known as a many-to-one
relationship.
For example, Student enrolls for only one course, but a course can have many students.
d. Many-to-many relationship
When more than one instance of the entity on the left, and more than one instance of an
entity on the right associates with the relationship then it is known as a many-to-many
relationship.
For example, Employee can assign by many projects and project can have many
employees.
Notation of ER diagram
Database can be represented using the notations. In ER diagram, many notations are
used to express the cardinality. These notations are as follows:
Cardinality
Cardinality means how the entities are arranged to each other or what is the relationship
structure between entities in a relationship set. In a Database Management System,
Cardinality represents a number that denotes how many times an entity is participating
with another entity in a relationship set. The Cardinality of DBMS is a very important
attribute in representing the structure of a Database. In a table, the number of rows or
tuples represents the Cardinality.
Cardinality Ratio
Cardinality ratio is also called Cardinality Mapping, which represents the mapping of
one entity set to another entity set in a relationship set. We generally take the example
of a binary relationship set where two entities are mapped to each other.
1. One to one
2. Many to one
3. One to many
4. Many to many
One to One
One to one cardinality is represented by a 1:1 symbol. In this, there is at most one
relationship from one entity to another entity. There are a lot of examples of one-to-one
cardinality in real life databases.
For example, one student can have only one student id, and one student id can belong
to only one student. So, the relationship mapping between student and student id will be
one to one cardinality mapping.
Another example is the relationship between the director of the school and the school
because one school can have a maximum of one director, and one director can belong
to only one school.
Note: it is not necessary that there would be a mapping for all entities in an entity set in
one-to-one cardinality. Some entities cannot participate in the mapping.
Many to One Cardinality:
In many to one cardinality mapping, from set 1, there can be multiple sets that can make
relationships with a single entity of set 2. Or we can also describe it as from set 2, and
one entity can make a relationship with more than one entity of set 1.
One to one Cardinality is the subset of Many to one Cardinality. It can be represented by
M:1.
For example, there are multiple patients in a hospital who are served by a single doctor,
so the relationship between patients and doctors can be represented by Many to one
Cardinality.
One to Many Cardinalities:
In One-to-many cardinality mapping, from set 1, there can be a maximum single set that
can make relationships with a single or more than one entity of set 2. Or we can also
describe it as from set 2, more than one entity can make a relationship with only one
entity of set 1.
In many, many cardinalities mapping, there can be one or more than one entity that can
associate with one or more than one entity of set 2. In the same way from the end of set
2, one or more than one entity can make a relation with one or more than one entity of
set 1.
It is represented by M: N or N: M.
One to one cardinality, One to many cardinalities, and Many to one cardinality is the
subset of the many to many cardinalities.
For Example, in a college, multiple students can work on a single project, and a single
student can also work on multiple projects. So, the relationship between the project and
the student can be represented by many to many cardinalities.
Appropriate Mapping Cardinality
Evidently, the real-world context in which the relation set is modeled determines the
Appropriate Mapping Cardinality for a specific relation set.
❖ 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.
For example, ID is used as a key in the Student table because it is unique for each
student. In the PERSON table, passport_number, license_number, SSN are keys since
they are unique for each person.
Types of keys:
1. Primary key
○ It is the first key used to identify one and only one instance of an entity uniquely.
An entity can contain multiple keys, as we saw in the PERSON table. The key
which is most suitable from those lists becomes a primary key.
○ In the EMPLOYEE table, ID can be the primary key since it is unique for each
employee. In the EMPLOYEE table, we can even select License_Number and
Passport_Number as primary keys since they are also unique.
○ For each entity, the primary key selection is based on requirements and
developers.
2. Candidate key
○ Except for the primary key, the remaining attributes are considered a candidate
key. The candidate keys are as strong as the primary key.
For example: In the EMPLOYEE table, id is best suited for the primary key. The rest of
the attributes, like SSN, Passport_Number, License_Number, etc., are considered a
candidate key.
3. Super Key
Super key is an attribute set that can uniquely identify a tuple. A super key is a superset
of a candidate key.
For example: In the above EMPLOYEE table, for(EMPLOEE_ID, EMPLOYEE_NAME), the
name of two employees can be the same, but their EMPLYEE_ID can't be the same.
Hence, this combination can also be a key.
4. Foreign key
○ Foreign keys are the column of the table used to point to the primary key of
another table.
○ In the EMPLOYEE table, Department_Id is the foreign key, and both the tables are
related.
5. Alternate key
For example, employee relation has two attributes, Employee_Id and PAN_No, that act
as candidate keys. In this relation, Employee_Id is chosen as the primary key, so the
other candidate key, PAN_No, acts as the Alternate key.
6. Composite key
Whenever a primary key consists of more than one attribute, it is known as a composite
key. This key is also known as Concatenated Key.
The key created using arbitrarily assigned data are known as artificial keys. These keys
are created when a primary key is large and complex and has no relationship with many
other relations. The data values of the artificial keys are usually numbered in a serial
order.
● Objects –
An object is an abstraction of a real world entity or we can say it is an instance of class.
Objects encapsulates data and code into a single unit which provide data abstraction by
hiding the implementation details from the user. For example: Instances of student,
doctor, engineer in above figure.
● Attribute –
An attribute describes the properties of object. For example: Object is STUDENT and its
attribute are Roll no, Branch, Setmarks() in the Student class.
● Methods –
Method represents the behavior of an object. Basically, it represents the real-world
action. For example: Finding a STUDENT marks in above figure as Setmarks().
● Class –
A class is a collection of similar objects with shared structure i.e. attributes and behavior
i.e. methods. An object is an instance of class. For example: Person, Student, Doctor,
Engineer in above figure.
class student
{
char Name[20];
int roll_no;
--
--
public:
void search();
void update();
}
In this example, students refers to class and S1, S2 are the objects of class which can be
created in main function.
● Inheritance –
By using inheritance, new class can inherit the attributes and methods of the old class
i.e. base class. For example: as classes Student, Doctor and Engineer are inherited from
the base class Person.
1. Universities:
Anyone who needs information about the student, teacher, or course can easily retrieve
it from the database. Everything needs to be maintained because even after ten years,
information may be required, and the information may be useful, so maintaining
complete information is the primary responsibility of any university or educational
institution.
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.
Nowadays, everyone has a smartphone and accounts on various social media sites like
Facebook, LinkedIn, Pinterest, Twitter, Instagram, etc. People can chat with their friends
and family and make new friends from all over the world. Social media has millions of
accounts, which means they have a huge amount of data that needs to be stored and
maintained. Social media sites use databases to store information about users, images,
videos, chats, etc.
There are hundreds and thousands of books in the library, so it is not easy to maintain
the records of the books in a register or diary, so a database management system is
used which maintains the information of the library efficiently. The library database
stores information like book name, issue date, author name, book availability, book
issuer name, book return details, etc.
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 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.
When there is big data regarding accounting and finance, there is a need to maintain a
large amount of data, which is done with the help of a database. The database stores
data such as accounting details, bank details, purchases of stocks, invoice details, sales
records, asset details, etc. Accounting and finance database helps in maintaining and
analyzing historical data.
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, transactions, etc. All the information is kept secure and
maintained by the database.
It is one of the applications of database management systems that contain data such
as passenger name, passenger check-in, passenger departure, flight schedule, number
of flights, distance from source to destination, reservation information, pilot details,
accounting detail, route detail, etc. The database provides maintenance and security to
airline data.
11. Telecommunication:
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.
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:
15. Insurance:
Requirements Analysis
Requirements analysis is the first phase that focuses on understanding the goals
and requirements for the database. It involves:
● Identifying the purpose and scope of the database – what data needs to be
stored and why.
● Determining what applications will use the database – this helps anticipate
future data access needs.
● Interviewing stakeholders and users to understand reporting, analysis, and
other requirements.
● Identifying crucial entities, attributes, relationships, and constraints for the
data model.
Thorough requirements gathering helps design a database that contains the right
data elements to meet business objectives.
5. Database Implementation
Database implementation is the actual creation of the database and all its
objects on the chosen DBMS platform. It involves these steps:
● Use of Data Definition Language (DDL) statements to create the database,
tables, indexes, keys, triggers, procedures, and other elements designed in
the physical model.
● Loading initial master data or reference data needed by the applications.
● Granting access permissions and roles to users and groups.
● Testing the database operations and performance using dummy data.
● Finalizing documentation for the database schema, processes, security
model etc.
Successful implementation brings the database design to life on production
servers.
❖ Database Users
❖ Advantages of DBMS
Advantages of Database Management System (DBMS):
Some of them are given as follows below.
1. Better Data Transferring: Database management creates a place where users have an
advantage of more and better-managed data. Thus making it possible for end-users to
have a quick look and to respond fast to any changes made in their environment.
2. Better Data Security: The more accessible and usable the database, the more it is prone
to security issues. As the number of users increases, the data transferring or data
sharing rate also increases thus increasing the risk of data security. It is widely used in
the corporate world where companies invest money, time, and effort in large amounts to
ensure data is secure and is used properly. A Database Management System (DBMS)
provides a better platform for data privacy and security policies thus, helping companies
to improve Data Security.
3. Better data integration: Due to the Database Management System we have an access to
well managed and synchronized form of data thus it makes data handling very easy and
gives an integrated view of how a particular organization is working and also helps to
keep a track of how one segment of the company affects another segment.
4. 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”,
or when the price of a product is $86.95 in the local system of the company and its
National sales office system shows the same product price as $84.95. So if a database
is properly designed then Data inconsistency can be greatly reduced hence minimizing
data inconsistency.
5. Faster data Access: The Database management system (DBMS) helps to produce quick
answers to database queries thus making data access faster and more accurate. For
example, to read or update the data. For example, end-users, when dealing with large
amounts of sale data, will have enhanced access to the data, enabling a faster sales
cycle. Some queries may be like:
● What is the increase in sales in the last three months?
● What is the bonus given to each of the salespeople in the last five months?
● How many customers have a credit score of 850 or more?
6. Better decision making: Due to DBMS now we have Better managed data and Improved
data access because of which we can generate better quality information hence on this
basis better decisions can be made. Better Data quality improves accuracy, validity, and
time it takes to read data. DBMS does not guarantee data quality, it provides a
framework to make it easy to improve data quality. DBMS provides powerful data
analysis and reporting tools that allow users to make informed decisions based on data
insights. This helps organizations to improve their decision-making processes and
achieve better business outcomes.
7. Increased end-user productivity: The data which is available with the help of a
combination of tools that transform data into useful information, helps end-users to make
quick, informative, and better decisions that can make difference between success and
failure in the global economy.
8. Simple: Database management system (DBMS) gives a simple and clear logical view of
data. Many operations like insertion, deletion, or creation of files or data are easy to
implement.
9. Data abstraction: The major purpose of a database system is to provide users with an
abstract view of the data. Since many complex algorithms are used by the developers to
increase the efficiency of databases that are being hidden by the users through various
data abstraction levels to allow users to easily interact with the system.
10. Reduction in data Redundancy: When working with a structured database, DBMS
provides the feature to prevent the input of duplicate items in the database. for e.g. – If
there are two same students in different rows, then one of the duplicate data will be
deleted.
11. Application development: A DBMS provides a foundation for developing applications that
require access to large amounts of data, reducing development time and costs.
12. Data sharing: A DBMS provides a platform for sharing data across multiple applications
and users, which can increase productivity and collaboration.
13. Data organization: A DBMS provides a systematic approach to organizing data in a
structured way, which makes it easier to retrieve and manage data efficiently.
14. The atomicity of data can be maintained: That means, if some operation is
performed on one particular table of the database, then the change must be reflected
for the entire database.
15. The DBMS allows concurrent access to multiple users by using the synchronization
technique.
16. Data consistency and accuracy: DBMS ensures that data is consistent and accurate by
enforcing data integrity constraints and preventing data duplication. This helps to
eliminate data discrepancies and errors that can occur when data is stored and
managed manually.
17. Improved data security: DBMS provides a high level of data security by offering user
authentication and authorization, data encryption, and access control mechanisms. This
helps to protect sensitive data from unauthorized access, modification, or theft.
18. Efficient data access and retrieval: DBMS allows for efficient data access and retrieval
by providing indexing and query optimization techniques that speed up data retrieval.
This reduces the time required to process large volumes of data and increases the
overall performance of the system.
19. Scalability and flexibility: DBMS is highly scalable and can easily accommodate changes
in data volumes and user requirements. DBMS can easily handle large volumes of data,
and can scale up or down depending on the needs of the organization. It provides
flexibility in data storage, retrieval, and manipulation, allowing users to easily modify the
structure and content of the database as needed.
20. Improved productivity: DBMS reduces the time and effort required to manage data,
which increases productivity and efficiency. It also provides a user-friendly interface for
data entry and retrieval, which reduces the learning curve for new users.
❖ Disadvantages of DBMS
There are many advantages and disadvantages of DBMS (Database Management System).
The disadvantages of DBMS are explained below.
1. Increased Cost:
These are different types of costs:
2. Complexity:
As we all know that nowadays all companies are using the database management system as it
fulfills lots of requirements and also solves the problem. But a problem arises, that is all this
functionality has made the database management system an extremely complex software. For
the proper requirement of DBMS, it is very important to have a good knowledge of it by the
developers, DBA, designers, and also the end-users. This is because if any one of them does
not acquire proper and complete skills then this may lead to data loss or database failure.
These failures may lead to bad design decisions due to which there may be serious and bad
consequences for the organization. So this complex system needs to be understood by
everyone using it. As it cannot be managed very easily. All this shows that a database
management system is not a child’s game as it cannot be managed very easily. It requires a lot
of management. A good staff is needed to manage this database at times when it becomes very
complicated to decide where to pick data from and where to save it.
3. Currency Maintenance:
This is very necessary to keep your system current because efficiency which is one of the
biggest factors and needs to be overlooked must be maximized. That is we need to maximize
the efficiency of the database system to keep our system current. For this, frequent updation
must be performed on all the components as new threats come daily. DBMS should be updated
according to the current scenario. Also, security measures must be implemented. Due to
advancement in database technology, training cost tends to be significant.
4. Performance:
The traditional file system is written for small organizations and for some specific applications
due to which performance is generally very good. But for the small-scale firms, DBMS does not
give a good performance as its speed is very slow. As a result, some applications will not run as
fast as they could. Hence it is not good to use DBMS for small firms. Because performance is a
factor that is overlooked by everyone. If performance is good then everyone (developers,
designers, end-users) will use it easily and it will be user-friendly too. As the speed of the
system totally depends on the performance so performance needs to be good.
5. Frequency Upgrade/Replacement Cycles:
Nowadays in this world, we need to stay up-to-date about the latest technologies, developments
arriving in the market. Frequent upgrade of the products is done by the DBMS vendors to add
new functionality to the systems. New upgrade versions of the software often come bundled.
Sometimes these updates also need hardware upgrades. Sometimes these changes and
updates are so fast that the users find it difficult to work with that system because it is not easy
to learn new commands and understand them again when the new upgrades are done. All
these upgrades also cost money to train users, designers, etc. to use the new features.
6.Complex design :
Database design is complex, difficult and time consuming.
7.Damaged part : If one part of database is corrupted or damaged, then entire
database may get affected.
8.Compatibility: DBMS software may not be compatible with other software systems or
platforms, making it difficult to integrate with other applications.
9.Security: A DBMS can be vulnerable to security breaches if not properly configured and
managed. This can lead to data loss or theft.
❖ Storage management
Storage System in DBMS
A database system provides an ultimate view of the stored data. However, data in the
form of bits, bytes get stored in different storage devices.
In this section, we will take an overview of various types of storage devices that are
used for accessing and storing data.
○ Primary Storage
○ Secondary Storage
○ Tertiary Storage
Primary Storage
It is the primary area that offers quick access to the stored data. We also know the
primary storage as volatile storage. It is because this type of memory does not
permanently store the data. As soon as the system leads to a power cut or a crash, the
data also get lost. Main memory and cache are the types of primary storage.
○ Main Memory: It is the one that is responsible for operating the data that is
available by the storage medium. The main memory handles each instruction of
a computer machine. This type of memory can store gigabytes of data on a
system but is small enough to carry the entire database. At last, the main
memory loses the whole content if the system shuts down because of power
failure or other reasons.
1. Cache: It is one of the costly storage media. On the other hand, it is the fastest
one. A cache is a tiny storage media which is maintained by the computer
hardware usually. While designing the algorithms and query processors for the
data structures, the designers keep concern on the cache effects.
Secondary Storage
Secondary storage is also called as Online storage. It is the storage area that allows the
user to save and store data permanently. This type of memory does not lose the data
due to any power failure or system crash. That's why we also call it non-volatile storage.
There are some commonly described secondary storage media which are available in
almost every type of computer system:
○ Flash Memory: A flash memory stores data in USB (Universal Serial Bus) keys
which are further plugged into the USB slots of a computer system. These USB
keys help transfer data to a computer system, but it varies in size limits. Unlike
the main memory, it is possible to get back the stored data which may be lost
due to a power cut or other reasons. This type of memory storage is most
commonly used in the server systems for caching the frequently used data. This
leads the systems towards high performance and is capable of storing large
amounts of databases than the main memory.
○ Magnetic Disk Storage: This type of storage media is also known as online
storage media. A magnetic disk is used for storing the data for a long time. It is
capable of storing an entire database. It is the responsibility of the computer
system to make availability of the data from a disk to the main memory for
further accessing. Also, if the system performs any operation over the data, the
modified data should be written back to the disk. The tremendous capability of a
magnetic disk is that it does not affect the data due to a system crash or failure,
but a disk failure can easily ruin as well as destroy the stored data.
Tertiary Storage
It is the storage type that is external from the computer system. It has the slowest
speed. But it is capable of storing a large amount of data. It is also known as Offline
storage. Tertiary storage is generally used for data backup. There are following tertiary
storage devices available:
○ Tape Storage: It is the cheapest storage medium than disks. Generally, tapes are
used for archiving or backing up the data. It provides slow access to data as it
accesses data sequentially from the start. Thus, tape storage is also known as
sequential-access storage. Disk storage is known as direct-access storage as we
can directly access the data from any location on disk.
Storage Hierarchy
Besides the above, various other storage devices reside in the computer system. These
storage media are organized on the basis of data accessing speed, cost per unit of data
to buy the medium, and by medium's reliability. Thus, we can create a hierarchy of
storage media on the basis of its cost and speed.
❖ Query Processor
Query Processing in DBMS
Query Processing is the activity performed in extracting data from
the database. In query processing, it takes various steps for
fetching the data from the database. The steps involved are:
2. Optimization
3. Evaluation
The query processing works in the following way:
Evaluation
For this, with addition to the relational algebra translation, it is
required to annotate the translated relational algebra expression
with the instructions used for specifying and evaluating each
operation. Thus, after translating the user query, the system
executes a query evaluation plan.
○ The annotations in the evaluation plan may refer to the algorithms to be used for
the particular index or the specific operations.
○ Thus, a query evaluation plan defines a sequence of primitive operations used for
evaluating a query. The query evaluation plan is also referred to as the query
execution plan.
○ A query execution engine is responsible for generating the output of the given
query. It takes the query execution plan, executes it, and finally makes the output
for the user query.
Optimization
○ The cost of the query evaluation can vary for different types of queries. Although
the system is responsible for constructing the evaluation plan, the user does
need not to write their query efficiently.
○ For optimizing a query, the query optimizer should have an estimated cost
analysis of each operation. It is because the overall operation cost depends on
the memory allocations to several operations, execution costs, and so on.
Finally, after selecting an evaluation plan, the system evaluates the query and produces
the output of the query.
❖ Transaction Management
Transaction in Database Management Systems (DBMS) can be defined as a set of logically
related operations. It is the result of a request made by the user to access the contents of the
database and perform operations on it. It consists of various operations and has various states
in its completion journey. It also has some specific properties that must be followed to keep the
database consistent.
❖ System Structure
From ppt