Unit 1 (Notes)
Unit 1 (Notes)
Unit 1 (Notes)
Introduction of DBMS
1. Data modeling: A DBMS provides tools for creating and modifying data models,
which define the structure and relationships of the data in a database.
2. 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.
3. 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.
4. 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.
5. Backup and recovery: A DBMS provides mechanisms for backing up and
recovering the data in the event of a system failure.
6. DBMS can be classified into two types: Relational Database Management System
(RDBMS) and Non-Relational Database Management System (NoSQL or Non-
SQL)
7. RDBMS: Data is organized in the form of tables and each table has a set of rows
and columns. The data is related to each other through primary and foreign keys.
8. NoSQL: Data is organized in the form of key-value pairs, document, graph, or
column-based. These are designed to handle large-scale, high-performance
scenarios.
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.
Database Management System: The software which is used to manage
databases is called Database Management System (DBMS). For Example, MySQL,
Oracle, etc. are popular commercial DBMS used in different applications. DBMS
allows users the following tasks:
Data Definition: It helps in the creation, modification, and removal of definitions
that define the organization of data in the database.
Data Updation: It helps in the insertion, modification, and deletion of the actual
data in the database.
Data Retrieval: It helps in the retrieval of data from the database which can be
used by applications for various purposes.
User Administration: It helps in registering and monitoring users, enforcing data
security, monitoring performance, maintaining data integrity, dealing with
concurrency control, and recovering information corrupted by unexpected failure.
File System manages data using files on a hard disk. Users are allowed to create,
delete, and update the files according to their requirements. Let us consider the
example of file-based University Management System. Data of students is available to
their respective Departments, Academics Section, Result Section, Accounts Section,
Hostel Office, etc. Some of the data is common for all sections like Roll No, Name,
Father Name, Address, and Phone number of students but some data is available to a
particular section only like Hostel allotment number which is a part of the hostel
office. Let us discuss the issues with this system:
Redundancy of data: Data is said to be redundant if the same data is copied at
many places. If a student wants to change their Phone number, he or she has to get
it updated in various sections. Similarly, old records must be deleted from all
sections representing that student.
Inconsistency of Data: Data is said to be inconsistent if multiple copies of the
same data do not match each other. If the Phone number is different in Accounts
Section and Academics Section, it will be inconsistent. Inconsistency may be
because of typing errors or not updating all copies of the same data.
Difficult Data Access: A user should know the exact location of the file to access
data, so the process is very cumbersome and tedious. If the user wants to search
the student hostel allotment number of a student from 10000 unsorted students’
records, how difficult it can be.
Unauthorized Access: File Systems may lead to unauthorized access to data. If a
student gets access to a file having his marks, he can change it in an unauthorized
way.
No Concurrent Access: The access of the same data by multiple users at the same
time is known as concurrency. The file system does not allow concurrency as data
can be accessed by only one user at a time.
No Backup and Recovery: The file system does not incorporate any backup and
recovery of data if a file is lost or corrupted.
ADVANTAGES OR DISADVANTAGES:
1. Data organization: A DBMS allows for the organization and storage of data in a
structured manner, making it easy to retrieve and query the data as needed.
2. Data integrity: A DBMS provides mechanisms for enforcing data integrity
constraints, such as constraints on the values of data and access controls that
restrict who can access the data.
3. Concurrent access: 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.
4. Data security: A DBMS provides tools for managing the security of the data, such
as controlling access to the data and encrypting sensitive data.
5. Backup and recovery: A DBMS provides mechanisms for backing up and
recovering the data in the event of a system failure.
6. Data sharing: A DBMS allows multiple users to access and share the same data,
which can be useful in a collaborative work environment.
Consider an example of a student's file system. The student file will contain
information regarding the student (i.e. roll no, student name, course etc.). Similarly,
we have a subject file that contains information about the subject and the result file
which contains the information regarding the result.
Some fields are duplicated in more than one file, which leads to data redundancy. So
to overcome this problem, we need to create a centralized system, i.e. DBMS
approach.
DBMS:
A database approach is a well-organized collection of data that are related in a
meaningful way which can be accessed by different users but stored only once in a
system. The various operations performed by the DBMS system are: Insertion,
deletion, selection, sorting etc.
DBMS Architecture
o 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.
o The client/server architecture consists of many PCs and a workstation which are
connected via the network.
o DBMS architecture depends upon how users are connected to the database to get
their request done.
Types of DBMS Architecture
Database architecture can be seen as a single tier or multi-tier. But logically, database
architecture is of two types like: 2-tier architecture and 3-tier architecture.
1-Tier Architecture
o In this architecture, the database is directly available to the user. It means the user
can directly sit on the DBMS and uses it.
o Any changes done here will directly be done on the database itself. It doesn't provide
a handy tool for end users.
o 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
3-Tier Architecture
o The 3-Tier architecture contains another layer between the client and server. In this
architecture, client can't directly communicate with the server.
o The application on the client-end interacts with an application server which further
communicates with the database system.
o 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.
o The 3-Tier architecture is used in case of large web application.
1. Internal Level
o The internal level has an internal schema which describes the physical storage
structure of the database.
o The internal schema is also known as a physical schema.
o It uses the physical data model. It is used to define that how the data will be stored in
a block.
o The physical level is used to describe complex low-level data structures in detail.
2. Conceptual Level
o The conceptual schema describes the design of a database at the conceptual level.
Conceptual level is also known as logical level.
o The conceptual schema describes the structure of the whole database.
o The conceptual level describes what data are to be stored in the database and also
describes what relationship exists among those data.
o In the conceptual level, internal details such as an implementation of the data
structure are hidden.
o Programmers and database administrators work at this level.
3. External Level
o At the external level, a database contains several schemas that sometimes called as
subschema. The subschema is used to describe the different view of the database.
o An external schema is also known as view schema.
o Each view schema describes the database part that a particular user group is
interested and hides the remaining database from that user group.
o The view schema describes the end user interaction with database systems.
The Conceptual/ Internal Mapping lies between the conceptual level and the internal
level. Its role is to define the correspondence between the records and fields of the
conceptual level and files and data structures of the internal level.
The external/Conceptual Mapping lies between the external level and the Conceptual
level. Its role is to define the correspondence between a particular external and the
conceptual view.
Data Models
Data Model is the modeling of the data description, data semantics, and consistency
constraints of the data. It provides the conceptual tools for describing the design of a
database at each level of data abstraction. Therefore, there are following four data
models used for understanding the structure of the database:
1) Relational Data Model: This type of model designs the data in the form of rows
and columns within a table. Thus, a relational model uses tables for representing data
and in-between relationships. Tables are also called relations. This model was initially
described by Edgar F. Codd, in 1969. The relational data model is the widely used
model which is primarily used by commercial data processing applications.
4) Semistructured Data Model: This type of data model is different from the other
three data models (explained above). The semistructured data model allows the data
specifications at places where the individual data items of the same type may have
different attributes sets. The Extensible Markup Language, also known as XML, is
widely used for representing the semistructured data. Although XML was initially
designed for including the markup information to the text document, it gains
importance because of its application in the exchange of data.
Data Models
Data models define how the logical structure of a database is modeled. Data Models
are fundamental entities to introduce abstraction in a DBMS. Data models define
how data is connected to each other and how they are processed and stored inside
the system.
The very first data model could be flat data-models, where all the data used are to be
kept in the same plane. Earlier data models were not so scientific, hence they were
prone to introduce lots of duplication and update anomalies.
Entity-Relationship Model
Entity-Relationship (ER) Model is based on the notion of real-world entities and
relationships among them. While formulating real-world scenario into the database
model, the ER Model creates entity set, relationship set, general attributes and
constraints.
ER Model is best used for the conceptual design of a database.
ER Model is based on −
Entities and their attributes.
Relationships among entities.
These concepts are explained below.
Metadata itself follows a layered architecture, so that when we change data at one
layer, it does not affect the data at another level. This data is independent but
mapped to each other.
These commands are used to update the database schema that's why they come
under Data definition language.
(But in Oracle database, the execution of data control language does not have
the feature of rolling back.)
Interfaces in DBMS
A database management system (DBMS) interface is a user interface that allows for
the ability to input queries to a database without using the query language itself. User-
friendly interfaces provided by DBMS may include the following:
Menu-Based Interfaces
Forms-Based Interfaces
Graphical User Interfaces
Natural Language Interfaces
Speech Input and Output Interfaces
Interfaces for Parametric Users
Interfaces for the Database Administrator (DBA)
Menu-Based Interfaces
These interfaces present the user with lists of options (called menus) that lead the user
through the formation of a request. The basic advantage of using menus is that they
remove the tension of remembering specific commands and syntax of any query
language. The query is basically composed step by step by collecting or picking
options from a menu that is shown by the system. Pull-down menus are a very popular
technique in Web-based interfaces. They are also often used in browsing interfaces
which allow a user to look through the contents of a database in an exploratory and
unstructured manner.
Forms-Based Interfaces
A forms-based interface displays a form to each user. Users can fill out all of the form
entries to insert new data, or they can fill out only certain entries, in which case the
DBMS will redeem the same type of data for other remaining entries. These types of
forms are usually designed or created and programmed for users that have no
expertise in operating systems. Many DBMS’s have form specification languages
which are special languages that help specify such forms.
Example: SQL Forms is a form-based language that specifies queries using a form
designed in conjunction with the relational database schema.
Graphical User Interface
A GUI typically displays a schema to the user in diagrammatic form. The user then
can specify a query by manipulating the diagram. In many cases, GUI utilise both
menus and forms. Most GUI use a pointing device such as a mouse, to pick a certain
part of the displayed schema diagram.
Natural Language Interfaces
These interfaces accept requests written in English or some other language and
attempt to understand them. A Natural language interface has its own schema, which
is similar to the database conceptual schema as well as a dictionary of important
words.
The natural language interface refers to the words in its schema as well as to the set of
standard words in a dictionary to interpret the request. If the interpretation is
successful, the interface generates a high-level query corresponding to the natural
language and submits it to the DBMS for processing, otherwise, a dialogue is started
with the user to clarify any provided condition or request. The main disadvantage of
this is that the capabilities of this type of interface are not that advance.
Speech Input and Output Interfaces
There is limited use of speech be it for a query or an answer to a question or being a
result of a request it is becoming commonplace. Applications with limited vocabulary
such as inquiries for telephone directory, flight arrival/departure, and bank account
information are allowed speech for input and output to enable ordinary folks to access
this information.
The Speech input is detected using predefined words and used to set up the parameters
that are supplied to the queries. For output, a similar conversion from text or numbers
into speech takes place.
Interfaces for Parametric Users contain some commands that can be handled with a
minimum of keystrokes. It is generally used in bank transactions for transferring
money. These operations are performed repeatedly.
Interfaces for Database Administrators (DBA)
Most database system contains privileged commands that can be used only by the
DBA’s staff. These include commands for creating accounts, setting system
parameters, granting account authorization, changing a schema, and reorganizing the
storage structures of databases.