0% found this document useful (0 votes)
28 views14 pages

DBMS Notes

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views14 pages

DBMS Notes

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

DBMS:

1) Data: Raw, Facts and figures having no particular meaning (e.g. 1, ABC, 19 )
Example: Text, audio, video, image etc.
2) Information: if we organize them in the following way, then they collectively represent
meaningful information. Processed, meaningful, usable data.
Book b1
30-T1 students
20-T2
15-T3
10-T4

Roll no. Name age


1 ABC 19

3) Database: A database is a collection of interrelated/Similar data. For Example, a


university database organizes the data about students, faculty, admin staff, etc.
There are many databases available like MySQL, Sybase, Oracle, MongoDB, Informix,
PostgreSQL, SQL Server, etc.
4) DBMS: 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.
DBMS provides an environment to store and retrieve data in convenient and efficient
manner.
Evolution of Databases
The database has completed more than 50 years of journey of its evolution from flat-file system
to relational and objects relational systems.
File-Based
1968 was the year when File-Based database were introduced. In file-based databases, data was
maintained in a flat file.
Disadvantages of File system:
1) Data redundancy: same data stored in two different files
2) Data inconsistency: if the same data is updated in one file but not in another.
3) Difficulty in accessing data
4) Security problem
5) Data Relationships: File systems do not inherently support complex relationships
between data.
6) Scalability Issues: Managing large amounts of data in a file system is difficult
7) Backup and Recovery: While file systems may require manual backup processes.

Hierarchical Data Model

1968-1980 was the era of the Hierarchical Database. Prominent hierarchical database model was IBM's
first DBMS. It was called IMS (Information Management System).

Imagine a database for a retail company. The data might be organized as follows:

● Level 1: Company

o Level 2: Departments (e.g., Electronics, Clothing, Grocery)

▪ Level 3: Categories (e.g., Laptops, Phones under Electronics)

▪ Level 4: Products (e.g., Specific Laptop or Phone models)

Relational Database

1970 - Present: It is the era of Relational Database and Database Management. In 1970, the relational
model was proposed by E.F. Codd.

Relational database model has two main terminologies called instance and schema.

The instance is a table with rows or columns

Schema specifies the structure like name of the relation, type of each column and name.
Types of Databases
There are various types of databases used for storing different varieties of data:

1) Centralized Database

It is the type of database that stores data at a centralized database system.

2) Distributed Database

Unlike a centralized database system, in distributed systems, data is distributed among different
database systems of an organization.

3) Relational Database

This database is based on the relational data model, which stores data in the form of rows(tuple) and
columns(attributes), and together forms a table(relation).

Examples of Relational databases are MySQL, Microsoft SQL Server, Oracle, etc.

4) NoSQL Database

Non-SQL/Not Only SQL is a type of database that is used for storing a wide range of data sets. It stores
data in several different ways. MongoDb is best example of document-oriented database.
5) Cloud Database

A type of database where data is stored in a virtual environment and executes over the cloud computing
platform.

There are numerous cloud platforms, but the best options are:

o Amazon Web Services(AWS)

o Microsoft Azure

o Kamatera

o PhonixNAP

o ScienceSoft

o Google Cloud SQL, etc.

6) Object-oriented Databases

The type of database that uses the object-based data model approach for storing data in the
database system. The data is represented and stored as objects which are similar to the objects
used in the object-oriented programming language.

7) Hierarchical Databases

It is the type of database that stores data in the form of parent-children relationship nodes.
8) Network Databases

It is the database that typically follows the network data model. Here, the representation of data
is in the form of nodes connected via links between them

9) Personal Database

Collecting and storing data on the user's system defines a Personal Database.
File System VS DBMS

Basis DBMS Approach File System Approach

Data is distributed in many


Due to the centralized
files, and it may be of
Sharing of data approach, data sharing is
different formats, so it isn't
easy.
easy to share data.

The file system provides


DBMS gives an abstract
the detail of the data
Data Abstraction view of data that hides the
representation and storage
details.
of data.

DBMS provides a good It isn't easy to protect a file


Security and Protection
protection mechanism. under the file system.

The file system doesn't


DBMS provides a crash have a crash mechanism,
recovery mechanism, i.e., i.e., if the system crashes
Recovery Mechanism
DBMS protects the user while entering some data,
from system failure. then the content of the file
will be lost.

DBMS contains a wide


The file system can't
variety of sophisticated
Manipulation Techniques efficiently store and
techniques to store and
retrieve the data.
retrieve the data.

In the File system,


concurrent access has
DBMS takes care of
many problems like
Concurrent access of data
Concurrency Problems redirecting the file while
using some form of
deleting some information
locking.
or updating some
information.

The database system is The file system approach is


Cost
expensive to design. cheaper to design.
In this, the files and
Due to the centralization of application programs are
the database, the problems created by different
Data Redundancy and
of data redundancy and programmers so that there
Inconsistency
inconsistency are exists a lot of duplication
controlled. of data which may lead to
inconsistency.

The database structure is The file system approach


Structure
complex to design. has a simple structure.

Oracle, SQL Server,


Examples Cobol, C++
Sybase etc.

Advantage of DBMS
Controls redundancy
It stores all the data in a single database file, so it can control data redundancy.
Data sharing
An authorized user can share the data among multiple users.
Backup
It provides Backup and recovery subsystem. This recovery system creates automatic data from
system failure and restores data if required.

Disadvantage of DBMS
Size
It occupies large disk space and large memory to run efficiently.
Cost
DBMS requires a high-speed data processor and larger memory to run DBMS software, so it is
costly.
Complexity
DBMS creates additional complexity and requirements.
DBMS Architecture
o The DBMS design depends upon its architecture. DBMS architecture depends upon how
users are connected to the database to get their request done.

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
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
Example:
1. A librarian uses the client application to search for a book.
2. The client application sends an SQL query (e.g., SELECT * FROM books WHERE title
= 'The Great Gatsby') to the database server.
3. The database server processes the query and retrieves the relevant data.
4. The server sends the result (the details of the book "The Great Gatsby") back to the client
application.
5. The client application displays the result to the librarian.

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.
Example: A web-based e-commerce application.
● Client Side: A web browser that sends a request to a web server (like a shopping cart in
an online store).
● Application Layer: A web server running the business logic (like Node.js, Django, or
Spring Boot) processes the request, interacts with the database, and sends a response back
to the client.
● Database Layer: A relational database server like PostgreSQL, SQL Server, or
MongoDB stores all the data (like user details, product information, order details, etc.).

Fig: 3-tier Architecture


Data Model, Schema, and Instance in DBMS
1. Data Model
● Definition: A data model is a conceptual framework that defines how data is structured,
stored, and manipulated within a database management system (DBMS). It describes the
organization of data and the relationships between different data elements.

● Types of Data Models:


o Hierarchical Data Model: Data is organized in a tree-like structure. Each record
has a single parent and potentially multiple children.
o Network Data Model: Data is organized in a graph structure, allowing more
complex many-to-many relationships.
o Relational Data Model: Data is organized in tables (relations) with rows and
columns. Relationships between data are established using keys.
o Object-Oriented Data Model: Data is represented in the form of objects, similar
to object-oriented programming.
o Entity-Relationship (ER) Model: A conceptual data model that defines data
using entities, attributes, and relationships.
o Document Data Model: Used in NoSQL databases like MongoDB, where data is
stored in a document format, often as JSON or XML.
2. Schema
In DBMS (Database Management System), a schema is a logical structure that defines the
organization of data within the database. It provides a blueprint of how data is stored, organized.
Example of a Database Schema:
Let's consider an example schema for a University Database that manages information about
students, courses.
Schema for a University Database:
1. Students Table:
Column Name Data Type Constraint Description

PRIMARY KEY, NOT Unique identifier for each


StudentID INT
NULL student

FirstName VARCHAR(50) NOT NULL Student's first name


Column Name Data Type Constraint Description

LastName VARCHAR(50) NOT NULL Student's last name

DateOfBirth DATE Student's date of birth

Email VARCHAR(100) UNIQUE Student's email address


2. Courses Table:
Column Name Data Type Constraint Description

PRIMARY KEY, NOT Unique identifier for each


CourseID INT
NULL course

CourseName VARCHAR(100) NOT NULL Name of the course

Credits INT Number of credits for the course

Three schema Architecture


o The three schema architecture is also called ANSI/SPARC architecture or three-level
architecture.
o This framework is used to describe the structure of a specific database system.
o The three schema architecture is also used to separate the user applications and physical
database.
o The three schema architecture contains three-levels. It breaks the database down into
three different categories.
Physical Schema:
● Definition: Describes the physical storage of data on the hardware. It defines how the
data is stored in blocks of storage (like hard disks, SSDs), indexing mechanisms, file
structures, and other physical aspects.
Logical Schema:
● Definition: Describes the logical structure of the entire database. It defines tables,
columns, data types, relationships, and constraints but does not specify how the data is
stored physically.
View Schema (External Schema):
● Definition: Also known as an external schema or subschema, it represents the
customized views of the data for different users or user groups. These views are created
to provide a tailored view of the database to different users according to their needs and
access permissions.
3. Instance
● Definition: An instance refers to the actual content of a database at a specific point in
time. It represents a snapshot of the data that conforms to the database schema.
Relationship Between Schema and Instance
● Schema: A schema is a design or structure of the database that defines the logical
organization of data. It is like a blueprint and does not change frequently.
o Example: Consider a schema that defines a Customer table:
CREATE TABLE Customer (
CustomerID INT PRIMARY KEY,
Name VARCHAR(100),
Email VARCHAR(100),
PhoneNumber VARCHAR(15),
Address VARCHAR(255)
);
o Here, the schema defines the structure of the table, including the column names,
data types, and constraints.
● Instance: An instance is the actual content of the database at a given time, which
includes the data stored in tables according to the schema.
o Example: An instance of the Customer table at a specific time might look like:

CustomerID Name Email PhoneNumber Address


John [email protected] 123 Elm
1 1234567890
Doe m St, City
Jane [email protected] 456 Oak
2 9876543210
Smith m St, Town

You might also like