Dbms Mod1fullshirin
Dbms Mod1fullshirin
What is Data?
Data is a collection of a distinct small unit of information. It can be used in a variety of
forms like text, numbers, media, bytes, etc. it can be stored in pieces of paper or
electronic memory, etc.
Word 'Data' is originated from the word 'datum' that means 'single piece of information.'
It is plural of the word datum.
In computing, Data is information that can be translated into a form for efficient
movement and processing. Data is interchangeable.
What is Database?
A database is an organized collection of data, so that it can be easily accessed and
managed.
You can organize data into tables, rows, columns, and index it to make it easier to find
relevant information.
There are many databases available like MySQL, Sybase, Oracle, MongoDB, Informix,
PostgreSQL, SQL Server, etc.
SQL or Structured Query Language is used to operate on the data stored in a database.
SQL depends on relational algebra and tuple relational calculus.
What is Database
The database is a collection of inter-related data which is used to retrieve, insert
and delete the data efficiently. It is also used to organize the data in the form of a table,
schema, views, and reports, etc.
For example: The college Database organizes the data about the admin, staff, students
and faculty etc.
Using the database, you can easily retrieve, insert, and delete the information.
Characteristics of DBMS
o It uses a digital repository established on a server to store and manage the
information.
o It can provide a clear and logical view of the process that manipulates data.
o DBMS contains automatic backup and recovery procedures.
o It contains ACID properties which maintain data in a healthy state in case of
failure.
o It can reduce the complex relationship between data.
o It is used to support manipulation and processing of data.
o It is used to provide security of data.
o It can view the database from different viewpoints according to the
requirements of the user.
Advantages of DBMS
o Controls database redundancy: It can control data redundancy because it
stores all the data in one single database file and that recorded data is placed
in the database.
o Data sharing: In DBMS, the authorized users of an organization can share
the data among multiple users.
o Easily Maintenance: It can be easily maintainable due to the centralized
nature of the database system.
o Reduce time: It reduces development time and maintenance need.
o Backup: It provides backup and recovery subsystems which create automatic
backup of data from hardware and software failures and restores the data if
required.
o multiple user interface: It provides different types of user interfaces like
graphical user interfaces, application program interfaces
Disadvantages of DBMS
o Cost of Hardware and Software: It requires a high speed of data processor
and large memory size to run DBMS software.
o Size: It occupies a large space of disks and large memory to run them
efficiently.
o Complexity: Database system creates additional complexity and
requirements.
o Higher impact of failure: Failure is highly impacted the database because in
most of the organization, all the data stored in a single database and if the
database is damaged due to electric failure or database corruption then the
data may be lost forever.
Database Applications
Nowadays, any business that has small or large amounts of data needs a
database to store and manage the information. The database is an easy, reliable,
secure, and efficient way to maintain business information. There are many applications
where databases are used.
In this article, we will discuss some of the applications of databases, which are
mentioned below:
Key Difference Between File System and
DBMS
A file system is software that manages and organizes the files
in a storage medium, whereas a DBMS is a software
application that is used for accessing, creating, and managing
databases.
The file system doesn’t have a crash recovery mechanism; on
the other hand, the DBMS provides a crash recovery
mechanism.
Data inconsistency is higher in the file system. On the
contrary, data inconsistency is low in a database management
system.
File system does not provide support for complicated
transactions, while in the DBMS system, it is easy to
implement complicated transactions using SQL.
File system does not offer concurrency, whereas the DBMS
provides a concurrency facility.
What is DBMS?
Database Management System (DBMS) is 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 store and retrieve data.
Where to use Database approach used in File system approach used in large
large systems which interrelate
many files. systems which interrelate many file
Database users in DBMS can be categorized based on their interaction with the
databases. According to the tasks performed by the database users on the
databases, we can categorize them into seven categories as follows:
Database Administrators (DBAs) have full control of the database and they
are sometimes known as the super-users of the database. They work alongside
developers in order to discuss and design the overall structure of the database
including layouts, functionalities, workflow, etc.
Database Administrators (DBAs) have all the privileges allowed by the DBMS.
They have to update the database timely in terms of technology, functionality, and
workflow in order to meet future requirements and in making the database ready for
future scope.
Also, Database Administrators (DBAs) monitor the backup & recovery of the
database records and provide technical support as well. If the technical team raises
any concern, DBAs have to resolve it.
Database Designers?
As the name suggests, Database Designers are the users in DBMS who
design and create the structure of the database including triggers, indexes,
schemas, entity relationships, tables, constraints,, etc. which complete the
database.
Database Designers are the type of database users in DBMS who are
responsible for implementing the overall design of the database. They decide
which form of data needs to be stored, what kind of relations exist among different
entities of the database, what will be the type of attributes, etc.
, For example, Railway ticket booking users in general are naive/parametric end
users as they don't have much knowledge about DBMS and directly use railway
booking applications to book their tickets.
System Analyst?
System Analysts are the type of database users in DBMS who analyze the
requirements of Naive / Parametric End users. It is their responsibility to check
whether all the requirements of end users are satisfied or not.
Sophisticated Users?
Sophisticated users are the type of database users in DBMS who
know DBMS (DDL & DML commands) and are familiar with the database.
Sophisticated users can be business analysts, engineers, scientists, system
analysts, etc.
Sophisticated users can develop or access their database applications
according to the requirements, without actually writing the program code for it. These
users are also known as SQL programmers as they can interact with the
database directly using SQL queries using query processors. Using SQL queries,
they can fetch the data from the database. They can also delete, update or insert
new data into the database.
For example: Data Engineers & Developers who are familiar with the
database, directly access the database using SQL queries rather than writing
programming code for accessing the database again. Hence, they are termed as
sophisticated users.
Casual/Temporary users have little knowledge about DBMS and each time
they try to access the database, they require new information.
For example: High-level management people are casual users who have
little knowledge about DBMS and hence, they can access the database to either fill
in new information or retrieve existing results.
Data models are used to describe how the data is stored, accessed, and updated in a DBMS. A
set of symbols and text is used to represent them so that all the members of an organization
can understand how the data is organized. It provides a set of conceptual tools that are vastly
used to represent the description of data.
There are many types of data models that are used in the industry.
The hierarchical data model is one of the oldest data models, developed in the 1950s by IBM.
In this data model, the data is organized in a hierarchical tree-like structure. This data model
can be easily visualized because each record in DBMS has one parent and many children
(possibly 0) as shown in the image given below.
The above-given image represents the data model of the Vehicle database, vehicle are
classified into two types Viz. two-wheelers and four-wheelers and then they are further
classified.
The main drawback we can see here is we can only have one too many relationships under
this model, hence the hierarchical data model is very rarely used nowadays.
Network Model
A network model is nothing but a generalization of the hierarchical data model as this data
model allows many to many relationships therefore in this model a record can also have more
than one parent.
The network model in DBMS can be represented as a graph and hence it replaces the
hierarchical tree with a graph in which object types are the nodes and relationships are the
edges.
For example –
Here you can see all three departments are linked with the director which was not possible in
the hierarchical data model.
In the network model, there can be many possible paths to reach a node from the root node
(College is the root node in the above case), therefore the data can be accessed efficiently
when compared to the hierarchical data model. But, on the other hand, the process of
insertion and deletion of data is quite complex.
ER model develops a conceptual view of the data hence it can be used as a blueprint to
implement the database in the future.
Developers can easily understand the system just by looking at ER diagram. Let's first have a
look at the components of an ER diagram.
Entity - Anything that has an independent existence about which we collect the data. To
learn more about Entity in DBMS click here.
They are represented as rectangles in the ER diagram. For example - Car, house, employee.
Entity Set - A set of the same type of entities is known as an entity set. For example - Set of
students studying in a college.
Attributes - Properties that define entities are called attributes. They are represented by an
ellipse shape.
Relationships - A relationship in DBMS is used to describe the association between
entities. They are represented as diamond or rhombus shapes in the ER diagram.
In the above-represented ER diagram, we have two entities that are Employee and Company,
and the relationship among them. Also, in the above-represented ER diagram, we can see that
both the employee and company have some attributes and the relationship is of "works in"
type, which means the employee works in a company.
Relational Model
This is the most widely accepted data model. In this model, the database is represented as
a collection of relations in the form of rows and columns of a two-dimensional
table. Each row is known as a tuple (a tuple contains all the data for an individual record)
while each column represents an attribute. For example -
103 Rishabh IT
104 Pulkit ME
The above table shows a relation "STUDENT" with attributes such as Stu. Id, Name, and
Branch which consists of 4 records or tuples.
Object-Oriented Data model
Since data is stored as objects we can easily store audio, video, images, etc in the database
which was very difficult and inconvenient to do in the relational model. As shown in the
image below two objects are connected with each other through links.
In the above image, we have two objects that are Employee and Department in which all the
data is contained in a single unit (object). They are linked with each other as they share a
common attribute i.e.i.e. Department_Id.
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.
This corresponds to the variable declaration of a The value of the variable in a program at a point in time
programming language. corresponds to an instance of the database schema.
The user doesn’t need to know the database schema details such as
data structure, table definition etc. user is only concerned about data which is
what returned back to the view level after it has been fetched from database
(present at the internal level).
External level is the “top level” of the Three Level DBMS Architecture.
2. Conceptual level
It is also called logical level. The whole design of the database such as
relationship among data, schema of data etc. are described in this level.
3. Internal level
This level is also known as physical level. This level describes how the
data is actually stored in the storage devices. This level is also responsible for
allocating space to the data. This is the lowest level of the architecture.
Data Independence
Now that you know what data independence means, let's discuss its
types. This is where your knowledge of the 3-level architecture is important!
It is concerned with the internal schema of the It is concerned with the conceptual schema of the
database. database.
It is easier to achieve as compared to logical data Logical data independence is difficult to achieve as
independence. compared to physical data independence.
Physical data independence is mostly concerned It is mostly focused on the structure or updating data
with how data is saved in the system. definitions.
Changes at the internal level may or may not be When the database's logical structure needs to be
Physical Data Independence Logical Data Independence
required to increase the overall performance of modified, the changes made at the logical level are
the database. crucial.
In most cases, a change at the physical level does If new fields are added or removed from the database,
not necessitate a change at the application then updates are required to be made in the
program level. application software.
Database Languages
Database Interfaces
A database interface is a layer that allows communication between an application
(like a web application or a program) and a database management system (DBMS). It
abstracts the details of how the database interacts with the application and provides a way to
perform operations such as inserting, querying, updating, and deleting data.
1. SQL-based Interfaces
o These interfaces use SQL (Structured Query Language) to interact with databases.
Applications write SQL queries to perform operations such as retrieving, inserting,
updating, or deleting data.
o Examples:
MySQL: A popular open-source relational database management system
(RDBMS) that uses SQL.
PostgreSQL: Another RDBMS that uses SQL and has advanced features.
SQLite: A lightweight, embedded SQL database engine.
2. Database Connectivity Methods
ODBC (Open Database Connectivity): A standard API for accessing database
management systems. It allows an application to connect to any DBMS that supports
ODBC drivers.
JDBC (Java Database Connectivity): A Java-based API for connecting to relational
databases from Java applications.
ADO.NET (ActiveX Data Objects): A set of classes in the .NET Framework for
interacting with databases in .NET applications.
DB-API: A database interface standard for Python, which allows communication with
relational databases.