Unit-2 Part-1
Unit-2 Part-1
▪ The term Information is defined as a set of data that are processed according to the
given requirements in a meaningful [Link] make the information useful and
meaningful,it must be processed,presented and structured in a given context.
▪ Information is processed from data and process context,purpose and [Link]
also includes raw data manipulations.
▪ Information gives meaning and increases the accuracy of the [Link] helps to
guarantee undesirability and reduces confusion.
▪ Thus,when the data is transformed into information,there is no unwanted and unless
detail contained in the information.
▪ Example of Information : Merit List,Receipts,Reports,Report Cards,etc.
Difference between Data and Information
Represented We can represent the data in the We can represent the information
form of a graph,data tree,tabular in the form of languages,thoughts
data,etc. on the basis of the given data.
Knowledge level Data is low level knowledge. Information is the second level of
knowledge.
Usefulness The data which is gathered by the Information is used and valuable
researcher can or cannot be because it is easily accessible for
useful. the researcher to use.
▪ For example : The college Database organizes the data about the
admin,staff,students and faculty etc.
• Storage engine:
This basic element of a DBMS is used to store data. The DBMS must interface with a file
system at the operating system (OS) level to store data. It can use additional components
to store data or interface with the actual data at the file system level.
• Metadata catalogue:
The DBMS must also provide an API to access the data, typically in the form of a database
access language that can be used to modify data but also create database objects and
secure or authorize access to the data. SQL is an example of a database access language
and encompasses several sets of commands, including control language for authorizing
data access, data definition language.
defining database structures and data manipulation language for reading and
modifying data.
• Optimization engine:
A DBMS can also provide an optimization engine that’s used to parse database access
language requests and turn them into actionable commands for accessing and
modifying data.
• Query processor:
After a query is optimized, the DBMS must provide a way to run the query and return
results.
• Lock manager:
This crucial component of the DBMS manages concurrent access to the same data.
Locks are required to ensure multiple users aren’t trying to modify the same data
simultaneously.
• Log manager:
The DBMS records all changes made to data managed by the DBMS. The record of
changes is known as the log, and the log manager component of the DBMS is used
to ensure that log records are made efficiently and accurately. The DBMS uses the
log manager during shutdown and startup to ensure data integrity, and it interfaces
with database utilities to create backups and run recoveries.
• Data utilities:
A DBMS also provides a set of utilities for managing and controlling database
activities. Examples of database utilities include reorganization, RUNSTATS, backup
and copy, recover, integrity check, load data, unload data and repair database.
• Reporting and monitoring tools:
Most DBMSes are integrated with reporting and monitoring tools to offer enhanced
functionality for managing and analysing data. Reporting tools generate reports,
whereas monitoring tools track various database metrics, such as resource
consumption and user activity.
Characteristics of DBMS
1. Data Abstraction:
Provides different levels of data abstraction (physical, logical, view level).
2. Data Independence:
Changes in the schema at one level do not affect the schema at the next higher level.
3. Data Security and Integrity:
Controls unauthorized access and ensures data correctness and consistency.
4. Efficient Data Access:
Uses advanced techniques for efficient storage and retrieval of data.
5. Transaction Support:
Manages transactions to ensure ACID (Atomicity, Consistency, Isolation,
Durability) properties.
6. Multi-user Access:
Supports concurrent access by multiple users.
7. Backup and Recovery:
Provides mechanisms for automatic backup and recovery from failures.
Advantages of DBMS
• 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.
• Data sharing:
In DBMS, the authorized users of an organization can share the data among multiple
users.
• Easily Maintenance:
It can be easily maintainable due to the centralized nature of the database system.
• Reduce time:
It reduces development time and maintenance need.
• Backup:
It provides backup and recovery subsystems which create automatic backup of data
from hardware and software failures and restores the data if required.
• Multiple user interface:
It provides different types of user interfaces like graphical user interfaces and
application program interfaces.
Disadvantages of DBMS
• Size:
It occupies a large space of disks and large memory to run them efficiently.
• 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.
The Importance of Databases
▪ Databases are essential tools in the digital world. They are organized collections of
data that facilitate the storage, retrieval, management, and manipulation of
information.
▪ At their core, databases are designed to hold data in a structured format, allowing
users and applications to efficiently access and update the information as needed.
▪ The importance of databases extends across nearly all fields but is particularly critical
in data science. Data science projects often involve analyzing large volumes of data
to derive insights, make predictions, or inform decision-making.
▪ Without databases, managing this data—especially as it grows in size and
complexity—would be cumbersome and error-prone. Databases provide a systematic
way to store data and ensure its integrity, security, and accessibility.
▪ Consider, for example, a retail company that tracks sales, customer interactions,
inventory, and supplier information. A database serves as the backbone of the
company’s operations, enabling them to analyze trends, forecast demand, optimize
inventory levels, and enhance customer experiences.
▪ Without a database, the company would struggle to handle the vast amounts of
data generated daily, let alone use this data to make informed business decisions.
▪ Different types of databases exist because different applications have different
data requirements and complexities. Databases are developed to improve
performance, functionality, and handle specific use-cases.
▪ The need for various database types arises due to differences in data
structures, access patterns, scalability needs, and consistency
requirements.
▪ Traditional business applications usually use structured data organized in tables with
predefined schemas. For this reason, Relational Databases (RDBMS) are commonly
used.
▪ With the growth of big data, social networks, and real-time analytics, relational
databases showed limitations in handling unstructured data, horizontal scaling, and
highly connected data.
▪ To solve these problems, NoSQL databases were introduced. They provide flexibility,
scalability, and better performance for data that does not fit the rigid structure of
relational databases.
▪ The rise of IoT and time-sensitive applications created the need for Time-Series
Databases, which are optimized to store and manage time-based data efficiently.
▪ Cloud Databases have become popular because they store data on remote servers,
providing better scalability, accessibility, and availability.
▪ In addition, Vector Databases are used in machine learning applications to efficiently
store and query high-dimensional vector data.
Types of Database
Types of Database
There are different types of databases designed to store and manage different kinds of
data. Some common types include Centralized Database, Distributed Database,
NoSQL Database, Cloud Database, Relational Database, Network Database,
Graph Database, and Hierarchical Database.
A Centralized Database stores all data in a single central location or server. Users
from different locations can access the data through applications with proper
authentication.
Example: A central library database used by all libraries in a university.
Imagine a college management system with campuses in different
[Link] database server is in delhi.
Location Role
● Reduced risk in data management – Changes or manipulation will not easily affect the
main data.
● Data consistency – Since data is stored in one central place, it remains consistent.
● Low cost – Managing data is cheaper because fewer vendors and systems are required.
● The database size becomes very large, which increases the response time for retrieving
data.
● If the central server fails, the entire data may be lost, which can cause huge loss.
(2) Distributed Database
A Distributed Database is a database system where data is stored at multiple locations
or servers instead of a single central location. These databases are connected through
communication links, allowing users to access data easily from different places.
Examples: Apache Cassandra, HBase, Ignite.
Each server:
● Stores part of the database
● Processes local queries
● Communicates with other servers
Now suppose you are in Mumbai and want to access Faculty Data.
What Happens Step-by-Step
1. User Sends Query
SELECT * FROM FACULTY;
The request goes to the local server in Mumbai.
2. Query Processor Checks Location
The Mumbai server checks where the faculty table is stored.
It finds that Faculty data is stored on the Delhi server.
3. Request Sent to Remote Server
The Mumbai server sends the request through the network to the Delhi server.
4. Delhi Server Processes Query
The Delhi server executes the query and retrieves the faculty records.
5. Data Returned
The Delhi server sends the result back to the Mumbai server.
6. Result Displayed
The Mumbai server shows the faculty data to the user.
Advantages of Distributed Database
● Modular development is possible because the system can be expanded by adding new computers to
the distributed system.
● Failure of one server does not affect the entire database, so data availability is higher.
(3) Relational Database
A Relational Database is based on the relational data model, where data is stored in the form of tables.
Each table consists of rows (tuples) and columns (attributes).
Relational databases use SQL (Structured Query Language) to store, manipulate, and manage data.
The relational database model was invented by E. F. Codd in 1970.
Each table contains a key that uniquely identifies the data.
Examples
● MySQL
● Oracle
● Microsoft SQL Server
● PostgreSQL
● MariaDB
Properties of Relational Database (ACID Properties)
A means Atomicity
C means Consistency
Consistency ensures that data remains correct before and after a transaction.
For example, in a bank account transaction, the total balance should remain correct after the
operation.
I means Isolation: There can be concurrent users for accessing data at the same time from the
database. Thus, isolation between the data should be isolated. For example, when multiple transactions
occur at the same time, the transaction affects should not be visible to the other transactions in the
database.
D means Durability: It ensures that once it completes the operation and commits the data, data
changes should remain permanent.
ACID Properties
NoSQL/Not Only SQL is a type of database that is used for storing a wide range of
data sets. It is not a relational database as it stores data not only in tabular form but in
several different ways. It came into existence when demand for building modern
applications increased. Thus, NoSQL provides a wide variety of database
technologies in response to the demands.
Examples:
• Apache Cassandra
• MongoDB
• Azure Cosmos DB
• Amazon DynamoDB
• CouchDB
Graph Databases: It is used for storing vast amounts of data in a graph structure. Most
commonly, social networking websites use the graph database.
A type of database where data is stored in a virtual environment and executes over the cloud computing
platform.
It provides users with various cloud computing services (SaaS, PaaS, IaaS, etc.) for accessing the
database. There are numerous cloud platforms, but the best options are:
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.
Examples:
● ObjectDB
● GemStone/S
● Versant
● Objectivity/DB
It is the type of database that stores data in the form of parent-child relationship nodes.
Here, it organizes data in a tree-like structure.
Examples:
• IBM IMS
• RDM Mobile
• Windows Registry
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. Unlike the hierarchical
database, it allows each record to have multiple children and parent nodes to form a
generalized graph structure.
Examples:
• Oracle CODASYL
• IDMS
(9) Personal Database
Collecting and storing data on the user's system defines a Personal Database.
This database is basically designed for a single user.
The type of database which creates and updates the database in real-time. It is
basically designed for executing and handling the daily data operations in several
businesses. For example, an organization uses operational databases for
managing per day transactions.
(11) Enterprise Database
1. Hardware:
The physical infrastructure, including servers, storage devices (disks, SSDs), memory (RAM), and input/output
devices (computers, networks) that support the database system.
2. Software:
The actual DBMS program (like MySQL, Oracle) that manages the database, plus operating systems, network
software, and application tools.
3. Data:
The raw facts stored, including operational data (customer names, balances) and metadata (data definitions,
schemas).
4. Procedures:
The rules, policies, and instructions for designing, using, and maintaining the database (e.g., backup, security,
login/logout, data validation).
5. Users (People):
The individuals interacting with the system, such as Database Administrators (DBAs), application developers, and
Types of DBMS Architecture
Definition:
In 1-Tier Architecture, the user interface, application logic, and database all are on the same system
(computer). The user directly interacts with the database without any server or network.
Key Points
In Excel:
● User interface
● Data storage
● Calculations / logic
1. Simple Architecture
2. Cost-Effective
3. Easy to Implement
2. Poor Security
● All data and application are on one computer.
● If someone gets access to that system, they can easily access the data.
3. No Centralized Control
● Data is stored locally on one device.
● It becomes difficult to manage or backup data across different systems.
Definition:
2-Tier Architecture is a client-server architecture where the client application
communicates directly with the database server.
How it Works
● The client side contains the user interface and application program.
● The server side contains the database and DBMS.
● The client connects to the server using APIs like ODBC or JDBC.
● Searching books
● Issuing books
● Checking due dates in a Library Management System.
● Responsible for:
○ Query processing
○ Transaction management
○ Data storage
2-Tier Architecture is a system where the client (application) directly
communicates with the database server.
1. Client Layer
2. Database Server Layer
Explanation of the Diagram
Client Side
Server Side
1. Easy to Access
Direct connection between client and database makes data retrieval faster.
2. Scalable
Cheaper than 3-Tier or Multi-Tier Architecture because fewer layers are involved.
Customer (User)
Application (Client)
Database (Server)
1) Enhanced Scalability
2) Data Integrity
3) Better Security
▪ DDL (Data Definition Language) is used to define and manage database structure
(tables, schema, etc.).
▪ It deals with structure, not data.
Commands
▪ Syntax(Create Database)
CREATE DATABASE database_name;
▪ Example:-
CREATE DATABASE college;
It will create database.
▪ Syntax(Create Table)
CREATE TABLE table_name (column_name datatype,column_name datatype);
▪ Example:-
CREATE TABLE student (sid INT,sname VARCHAR(20),semail INT,sge INT);
Creates a new table.
sid sname semail sage
2) ALTER command
Used to modify existing table structure.
1) Add new Column
Syntax :- ALTER TABLE table_name ADD column_name data_type;
Example:- ALTER TABLE student ADD scontact_no INT;
This will add new column into student table.
sid sname semail sage scontact_no
5) RENAME command
Used to change table name.
Syntax :- RENAME TABLE old_table_name TO new_table_name;
Example :- RENAME TABLE student TO college_student;
DML – Data Manipulation Language
Command
● INSERT
● UPDATE
● DELETE
1) INSERT command
We created student table above which is looke like this:
▪ If you want to skip column name in this method then you can skip.
Example:- INSERT INTO student(sid,name,semail) VALUES(3,’jiya’,’jiya@[Link]’);
Here user skip scontact_no which is [Link] SQL automatically add NULL into scontact_no
column.
●Here only name becomes jiya where sid=[Link] all name becomes jiya because we mention
condition.
3) DELETE
Command
● SELECT
Output:-
sid name semail scontact_no
Output :- mahi
sima
jiya
4) Select Particular Column and Particular Row
Syntax :
SELECT column_name FROM table_name WHERE condition;
Example :-Show student name whose id = 2;
Output :-
name
sima
DCL – Data Control Language
Examples
Example:
GRANT SELECT ON Student TO user1;
TCL – Transaction Control Language
Examples
Example:
COMMIT;