0% found this document useful (0 votes)
24 views

DBMS Notes

A DBMS is software that manages databases and allows users to create, access, and modify data. It provides features like data modeling, storage and retrieval, concurrency control, security, and backup/recovery. A DBMS can be either relational or non-relational. The document also discusses differences between file systems and DBMSs, as well as database architecture including 1-tier, 2-tier, and 3-tier models.

Uploaded by

Shabes khan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

DBMS Notes

A DBMS is software that manages databases and allows users to create, access, and modify data. It provides features like data modeling, storage and retrieval, concurrency control, security, and backup/recovery. A DBMS can be either relational or non-relational. The document also discusses differences between file systems and DBMSs, as well as database architecture including 1-tier, 2-tier, and 3-tier models.

Uploaded by

Shabes khan
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

UNIT-1

Database Management System

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.

Some key features of a DBMS include:

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.

Difference between File System and DBMS

File System Approach

File based systems were an early attempt to computerize the manual system. It is also called
a traditional based approach in which a decentralized approach was taken where each
department stored and controlled its own data with the help of a data processing specialist.
The main role of a data processing specialist was to create the necessary computer file
structures, and also manage the data within structures and design some application programs
that create reports based on file data.

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.
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
o The 2-Tier architecture is same as basic client-server. In the two-tier architecture,
applications on the client end can directly communicate with the database at the
server side. For this interaction, API's like: ODBC, JDBC are used.
o The user interfaces and application programs are run on the client-side.
o The server side is responsible to provide the functionalities like: query processing and
transaction management.
o To communicate with the DBMS, client-side application establishes a connection with
the server side.
Fig: 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.

Fig: 3-tier Architecture


Data Independence:

Data Independence is defined as a property of DBMS that helps you to change the Database
schema at one level of a database system without requiring to change the schema at the next
higher level. Data independence helps you to keep data separated from all programs that
make use of it.

You can use this stored data for computing and presentation. In many systems, data
independence is an essential function for components of the system.

In DBMS there are two types of data independence

1. Physical data independence


2. Logical data independence.

Levels of Database

Before we learn Data Independence, a refresher on Database Levels is important. The


database has 3 levels as shown in the diagram below

1. Physical/Internal
2. Conceptual
3. External
Physical data Independence

Physical data independence helps you to separate conceptual levels from the
internal/physical levels. It allows you to provide a logical description of the database without
the need to specify physical structures. Compared to Logical Independence, it is easy to
achieve physical data independence.

With Physical independence, you can easily change the physical storage structures or devices
with an effect on the conceptual schema. Any change done would be absorbed by the
mapping between the conceptual and internal levels. Physical data independence is achieved
by the presence of the internal level of the database and then the transformation from the
conceptual level of the database to the internal level.

Examples of changes under Physical Data Independence

Due to Physical independence, any of the below change will not affect the conceptual layer.

 Using a new storage device like Hard Drive or Magnetic Tapes


 Modifying the file organization technique in the Database
 Switching to different data structures.
 Changing the access method.
 Modifying indexes.
 Changes to compression techniques or hashing algorithms.
 Change of Location of Database from say C drive to D Drive.

Logical data Independence

Logical Data Independence is the ability to change the conceptual scheme without changing

1. External views
2. External API or programs

Any change made will be absorbed by the mapping between external and conceptual levels.

When compared to Physical Data independence, it is challenging to achieve logical data


independence.

Examples of changes under Logical Data Independence


Due to Logical independence, any of the below change will not affect the external layer.
1. Add/Modify/Delete a new attribute, entity or relationship is possible without a rewrite
of existing application programs
2. Merging two records into one
3. Breaking an existing record into two or more records

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.

2) Entity-Relationship Data 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. This model was designed by Peter Chen and published
in 1976 papers. It was widely used in database designing. A set of attributes describe the
entities. For example, student_name, student_id describes the 'student' entity. A set of the
same type of entities is known as an 'Entity set', and the set of the same type of relationships
is known as 'relationship set'.

3) Object-based Data Model: An extension of the ER model with notions of functions,


encapsulation, and object identity, as well. This model supports a rich type system that
includes structured and collection types. Thus, in 1980s, various database systems following
the object-oriented approach were developed. Here, the objects are nothing but the data
carrying its properties.
4) Semi structured Data Model: This type of data model is different from the other three data
models (explained above). The semi structured 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 semi
structured 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.

Instances
An Instance is the state of an operational database with data at any given time. It contains
a snapshot of the database. The instances can be changed by certain CRUD operations, such
as like addition, and deletion of data. It may be noted that any search query will not make
any kind of changes in the instances.

Example:
Let’s say a table teacher in our database whose name is School, suppose the table has 50
records so the instance of the database has 50 records for now and tomorrow we are going
to add another fifty records so tomorrow the instance has a total of 100 records. This is
called an instance.

Schema
Schema is the overall description of the database. The basic structure of how the data will
be stored in the database is called schema.

Database Languages
o A DBMS has appropriate languages and interfaces to express database queries and
updates.
o Database languages can be used to read, store and update the data in the database.
1. Data Definition Language

o DDL stands for Data Definition Language. It is used to define database structure or
pattern.
o It is used to create schema, tables, indexes, constraints, etc. in the database.
o Using the DDL statements, you can create the skeleton of the database.
o 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.

Here are some tasks that come under DDL:

o Create: It is used to create objects in the database.


o Alter: It is used to alter the structure of the database.
o Drop: It is used to delete objects from the database.
o Truncate: It is used to remove all records from a table.
o Rename: It is used to rename an object.
o Comment: It is used to comment on the data dictionary.

2. Data Manipulation Language (DML)

DML stands for Data Manipulation Language. It is used for accessing and manipulating data
in a database. It handles user requests.

Here are some tasks that come under DML:

o Select: It is used to retrieve data from a database.


o Insert: It is used to insert data into a table.
o Update: It is used to update existing data within a table.
o Delete: It is used to delete all records from a table.
o Merge: It performs UPSERT operation, i.e., insert or update operations.
o Call: It is used to call a structured query language or a Java subprogram.
o Explain Plan: It has the parameter of explaining data.
o Lock Table: It controls concurrency.

3. Data Control Language (DCL)

o DCL stands for Data Control Language. It is used to retrieve the stored or saved data.
o The DCL execution is transactional. It also has rollback parameters.

(But in Oracle database, the execution of data control language does not have the
feature of rolling back.)

Here are some tasks that come under DCL:

o Grant: It is used to give user access privileges to a database.


o Revoke: It is used to take back permissions from the user.

There are the following operations which have the authorization of Revoke:

CONNECT, INSERT, USAGE, EXECUTE, DELETE, UPDATE and SELECT.

4. Transaction Control Language (TCL)

TCL is used to run the changes made by the DML statement. TCL can be grouped into a logical
transaction.

Here are some tasks that come under TCL:

o Commit: It is used to save the transaction on the database.


o Rollback: It is used to restore the database to original since the last Commit.
Database Interfaces

A software program known as a database management system (DBMS) is used to manage,


compile, and store data in a systematic manner. The user and the database are connected
through DBMS interfaces. They give users an easy-to-use interface so they may access and
change the data that is stored in the database. There are several DBMS interface types, each
created to meet certain user requirements.

The most typical kinds of DBMS interfaces are as follows −

Command-Line Interface (CLI)

The earliest and most fundamental form of DBMS interface is the command-line interface
(CLI). Through the use of a command prompt, users may communicate with the database by
inputting commands. Users can only access and modify the database using particular
commands and syntax. Today, programmers and database administrators are the main users
of CLI.
Graphical User Interface (GUI)

The most prevalent kind of DBMS interface used nowadays is the graphical user interface
(GUI). Users may interact with the database using the user-friendly interface's graphical
menus and icons. GUIs are user-friendly and need little to no programming experience. They
are mostly utilized by non-programmers who are end users.

Web-Based Interface

Users can access the database using a browser using the web-based interface. Users can use
online forms, buttons, and other graphical components to interact with the database using a
web browser. Because they can be accessed from any location with an internet connection,
web-based interfaces are common.

Natural Language Interface

This interface enables users to communicate with the database in their own language. The
system will convert user inquiries into SQL instructions and carry them out if they are entered
in plain English. Users who are unfamiliar with SQL commands might benefit from using
natural language interfaces.

Forms-Based Interface

Using the forms-based interface, users may enter data into the database using a graphical
user interface. Users can complete pre-made forms that provide fields for particular
categories of information, such as name, address, and phone number. Applications for data
entry frequently employ forms-based interfaces.

Menu-Based Interface

Users have access to a number of predefined menus and choices when using the menu-based
interface to interact with the database. Users can choose the menu choice that reflects the
intended action, such as adding or removing data, from the available options. The majority of
specialized applications and embedded systems employ menu-based interfaces.

Users can interact with the database thanks in large part to DBMS interfaces. The user's
technical proficiency, the nature of the program, and the target market all influence the
interface choice. The user experience and database usability may both be improved by
selecting the correct interface.

You might also like