0% found this document useful (0 votes)
5 views17 pages

DBMS Unit 1

A Database Management System (DBMS) is essential software for storing, managing, and retrieving data in structured formats, supporting various functions like data security, integrity, and backup. It contrasts with file systems by enforcing data integrity, relationships, and efficient querying. DBMS architecture can be categorized into 1-Tier, 2-Tier, and 3-Tier systems, each with its advantages and disadvantages, and employs various data models to represent and organize data effectively.

Uploaded by

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

DBMS Unit 1

A Database Management System (DBMS) is essential software for storing, managing, and retrieving data in structured formats, supporting various functions like data security, integrity, and backup. It contrasts with file systems by enforcing data integrity, relationships, and efficient querying. DBMS architecture can be categorized into 1-Tier, 2-Tier, and 3-Tier systems, each with its advantages and disadvantages, and employs various data models to represent and organize data effectively.

Uploaded by

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

DBMS UNIT-1

overview data base management system

A Database Management System (DBMS) is a software application or system


that allows users to efficiently store, manage, retrieve, and manipulate data in
a structured manner. DBMS plays a crucial role in modern information systems
and is used in a wide range of applications, from simple personal data
management to complex enterprise-level databases. Here's an overview of the
key components and functions of a DBMS:
1. Data: DBMS manages various types of data, including text, numbers,
dates, multimedia, and more. Data is organized into tables or collections,
each consisting of rows and columns.
2. Database: A database is a structured collection of data organized and
stored in a way that facilitates efficient data retrieval and manipulation.
Databases can range from small, single-user systems to large, distributed
databases serving multiple users and applications.
3. Schema: The schema defines the structure and organization of data
within the database. It specifies the tables, their attributes (columns),
data types, relationships, and constraints.
4. Data Manipulation: DBMS provides a set of query and manipulation
languages (e.g., SQL - Structured Query Language) to interact with the
database. Users can insert, update, delete, and retrieve data using these
languages.
5. Data Security: DBMS ensures data security by providing authentication
and authorization mechanisms. It restricts access to data based on user
roles and permissions to prevent unauthorized access.
6. Data Integrity: DBMS enforces data integrity constraints to maintain the
accuracy and consistency of data. Common constraints include primary
keys, foreign keys, and uniqueness constraints.
7. Data Backup and Recovery: DBMS offers backup and recovery
mechanisms to protect data from loss or corruption. Regular backups
and restore procedures are crucial for data reliability.
8. Concurrency Control: In multi-user environments, DBMS manages
concurrent access to data to prevent conflicts and ensure data
consistency. It uses locking and transaction management to achieve this.
9. Query Optimization: DBMS employs query optimization techniques to
improve the performance of data retrieval operations. It analyzes and
selects the most efficient execution plan for complex queries.
10.Indexing: To speed up data retrieval, DBMS uses indexing structures like
B-trees or hash indexes to create a searchable index of the data. This
reduces the time required to locate specific records.
11.Scalability: A good DBMS should be scalable to handle increasing data
volumes and user loads. Scalability can be achieved through techniques
like sharding, replication, and clustering.
12.Data Redundancy Control: DBMS minimizes data redundancy by
maintaining a centralized repository of data. This reduces the risk of
inconsistencies caused by duplicate information.

Database system VS File system


Database systems and file systems are two distinct approaches to managing
and organizing data. Here's a comparison between the two:
1. Data Structure:
 Database System: A database system organizes data into
structured formats, typically tables with rows and columns. It
enforces a predefined schema that specifies the structure and
relationships between data elements.
 File System: A file system stores data in an unstructured or semi-
structured manner. Data is organized into files and directories, and
there is no inherent structure enforced by the file system itself.
2. Data Integrity:
 Database System: Database systems ensure data integrity through
the use of constraints such as primary keys, foreign keys, and data
validation rules. ACID properties (Atomicity, Consistency, Isolation,
Durability) are typically followed to maintain data consistency.
 File System: File systems do not inherently enforce data integrity.
Ensuring data consistency and integrity is left to the responsibility
of the application or user.
3. Data Query and Retrieval:
 Database System: Database systems provide query languages like
SQL that allow users to query and retrieve data efficiently based
on various criteria. Complex queries and joins can be performed to
extract specific information from the database.
 File System: File systems do not offer built-in query languages.
Accessing specific data within files often requires reading and
parsing the entire file, which can be inefficient for large datasets.
4. Data Relationships:
 Database System: Database systems support the establishment of
relationships between data entities through foreign keys and
referential integrity. This enables efficient retrieval of related data.
 File System: File systems do not inherently support relationships
between files or data elements. Establishing and maintaining
relationships must be handled by the application or user.
5. Data Redundancy:
 Database System: Database systems minimize data redundancy by
centralizing data storage and allowing data to be shared among
different parts of an application. This reduces the risk of
inconsistent or duplicate data.
 File System: File systems can lead to data redundancy because the
same data may be stored in multiple files or locations, potentially
leading to inconsistencies.
6. Concurrency Control:
 Database System: Database systems provide built-in concurrency
control mechanisms to handle simultaneous access to data by
multiple users or processes. Locking and transaction management
ensure data consistency.
 File System: File systems typically lack sophisticated concurrency
control mechanisms, making it challenging to manage concurrent
access to shared files or data.
7. Scalability:
 Database System: Database systems are designed to handle large
datasets and concurrent users. They often provide mechanisms for
scaling, such as clustering and replication.
 File System: File systems may not be as scalable for handling large
datasets with complex relationships and access patterns.

Database System Architecture


Database system architecture refers to the overall design and structure of a
database management system (DBMS). It encompasses the various
components and layers that work together to store, manage, and provide
access to data efficiently. The architecture of a DBMS typically includes the
following components:
1. User Interface: This is the top layer of the architecture and is the part
that interacts directly with users and applications. It includes tools and
interfaces for data entry, querying, and reporting. Users interact with the
DBMS through SQL queries, application programming interfaces (APIs),
graphical user interfaces (GUIs), or web-based interfaces.
2. Query Processor: When a user submits a query, the query processor
component is responsible for parsing and analyzing the query, optimizing
its execution, and generating an execution plan. It decides how to
retrieve the data efficiently from the database.
3. Transaction Manager: The transaction manager ensures that database
transactions (groups of one or more SQL operations) are executed in a
manner that adheres to the ACID properties (Atomicity, Consistency,
Isolation, Durability). It handles transaction initiation, coordination, and
recovery in case of failures.
4. Storage Manager: The storage manager is responsible for managing the
physical storage of data on disk or in memory. It includes several
subcomponents:
 Buffer Manager: Manages a buffer pool in memory where
frequently accessed data is cached to reduce disk I/O.
 Data Files: These are the actual storage files on disk where data
tables, indexes, and other database objects are stored.
 Transaction Log: Stores a record of all transactions for recovery
purposes.
 Lock Manager: Controls access to data to ensure that multiple
transactions do not interfere with each other (concurrency
control).
5. Data Dictionary or Metadata Repository: This component stores
metadata about the database schema, including information about
tables, columns, data types, constraints, and relationships. It is used by
the query processor and other components for schema validation and
optimization.
6. Security and Authorization: This component manages user
authentication and authorization, ensuring that only authorized users
can access specific data and perform certain operations. It enforces
access control policies and security measures.
7. Concurrency Control Manager: It is responsible for managing concurrent
access to the database by multiple users or transactions. This includes
handling locks, ensuring data consistency, and preventing conflicts.
8. Backup and Recovery Manager: This component is responsible for
creating and managing database backups and restoring data in case of
system failures or data corruption. It ensures data durability and
availability.
9. Query Optimizer: The query optimizer is a crucial part of the query
processor that determines the most efficient way to execute a query by
considering available indexes, access paths, and other optimization
techniques.

Types of DBMS Architecture


There are several types of DBMS Architecture that we use according to the
usage requirements. Types of DBMS Architecture are discussed here.
 1-Tier Architecture
 2-Tier Architecture
 3-Tier Architecture
1-Tier Architecture
In 1-Tier Architecture the database is directly available to the user, the user can
directly sit on the DBMS and use it that is, the client, server, and Database are
all present on the same machine. For Example: to learn SQL we set up an SQL
server and the database on the local system. This enables us to directly interact
with the relational database and execute operations. The industry won’t use

this architecture they logically go for 2-Tier and 3-Tier Architecture.


Advantages of 1-Tier Architecture
Below mentioned are the advantages of 1-Tier Architecture.
 Simple Architecture: 1-Tier Architecture is the most simple architecture
to set up, as only a single machine is required to maintain it.
 Cost-Effective: No additional hardware is required for implementing 1-
Tier Architecture, which makes it cost-effective.
 Easy to Implement: 1-Tier Architecture can be easily deployed, and
hence it is mostly used in small projects.
2-Tier Architecture
The 2-tier architecture is similar to a basic client-server model. The application
at the client end directly communicates with the database on the server side.
APIs like ODBC and JDBC are used for this interaction. The server side is
responsible for providing query processing and transaction management
functionalities. On the client side, the user interfaces and application programs
are run. The application on the client side establishes a connection with the
server side in order to communicate with the DBMS.
An advantage of this type is that maintenance and understanding are easier,
and compatible with existing systems. However, this model gives poor
performance when there are a large number of users.

DBMS 2-Tier Architecture


Advantages of 2-Tier Architecture
 Easy to Access: 2-Tier Architecture makes easy access to the database,
which makes fast retrieval.
 Scalable: We can scale the database easily, by adding clients or by
upgrading hardware.
 Low Cost: 2-Tier Architecture is cheaper than 3-Tier Architecture
and Multi-Tier Architecture.
 Easy Deployment: 2-Tier Architecture is easy to deploy than 3-Tier
Architecture.
 Simple: 2-Tier Architecture is easily understandable as well as simple
because of only two components.
3-Tier Architecture
In 3-Tier Architecture, there is another layer between the client and the server.
The client does not directly communicate with the server. Instead, it interacts
with an application server which further communicates with the database
system and then the query processing and transaction management takes
place. This intermediate layer acts as a medium for the exchange of partially
processed data between the server and the client. This type of architecture is
used in the case of large web applications.

DBMS 3-Tier Architecture


Advantages of 3-Tier Architecture
 Enhanced scalability: Scalability is enhanced due to distributed
deployment of application servers. Now, individual connections need not
be made between the client and server.
 Data Integrity: 3-Tier Architecture maintains Data Integrity. Since there is
a middle layer between the client and the server, data corruption can be
avoided/removed.
 Security: 3-Tier Architecture Improves Security. This type of model
prevents direct interaction of the client with the server thereby reducing
access to unauthorized data.
Disadvantages of 3-Tier Architecture
 More Complex: 3-Tier Architecture is more complex in comparison to 2-
Tier Architecture. Communication Points are also doubled in 3-Tier
Architecture.
 Difficult to Interact: It becomes difficult for this sort of interaction to
take place due to the presence of middle layers.

DBMS

Data Models, Schema and Instance-


Data Models

Data models refers to how the logical structure of a database is made. Data
model acts as a conceptual tool that describes the data relationship, data
semantics and data constraints. Database uses three tier architecture so we need
to design the database at physical, logical and view level.
Categories of data model are −

Relational Data Model

In this model, the data is designed in form of rows and column within a table.
The tables are then going to establish the relationship among the data. Tables
are referred as relations because the relationship among the table or data is
going to be stored in relation only. It is also referred as a record-based model
and is most widely used data model. This model was initially described by
Edgar F. Codd, in 1969.

ER(Entity-Relationship) Data Model

It consists of a collection of basic objects called entities provided by


relationships among the entities. A entity is a real world object and is
distinguishable from other objects. This model was designed by Peter Chen and
published in 1976 papers.

Object-based Data Model

It is actually using the ER Model with object-oriented features like


encapsulation, inheritance etc. This model is used in systems with structured
and collection types.

Semi structured Data Model

It deals with the specification of data. i.e. individual data items of the same type
may have different sets of attributes. This data model is mainly used for
transferring the data among the applications. The language that supports is
XML(Extensible Markup Language).

Schema

It is used to logically represent the structure of a database along with the


relationship and organisation between them. It is considered as a blueprint of a
database which shows the relationship between tables.
Types of Schema
Conceptual schemas

It is used to gather initial requirements of projects by offering a detailed view of


the system.

Logical database schemas

It implies the rules that govern the database and define schema with tables,
view, relationship and integrity constraints.

Physical database schemas

Data gets stored within disk storage i.e. this schema refers to actual storage of
data.

Instance

The collection of information stored in the database at a particular moment is


called instance. It contains a snapshot of database. The data present in the
database can be changed frequently. Database instance is equal to the value of
the variable.

Data base system concept and architecture :-

Concepts of Database Systems


 Data − Data is the central component of every database system. The
information that has to be handled and saved is represented by data. It
could be structured, somewhat structured, or not at all. Structured data is
arranged into tables with rows and columns according to a predetermined
pattern. Examples include financial data, product specifications, and
client information. Data that is semi-structured, like JSON or XML, has
some structure but does not follow a strict standard. Text documents,
photos, and multimedia files are examples of unstructured data since they
don't have a predetermined structure.
 Database Management System (DBMS)− Software that makes it easier
to create, organize, and manipulate databases is known as a database
management system (DBMS). It offers a selection of tools and user
interfaces for effective data management. Data storage, data retrieval,
data manipulation, data security, and concurrency control are among a
DBMS's essential features. Popular DBMS s include PostgreSQL, Oracle,
MySQL, and Microsoft SQL Server.
 Database − A database is a structured collection of data that is
maintained and organized by a database management system (DBMS). It
is made up of one or more tables, each of which represents a different
entity or idea. Each row in a table represents one instance of the entity,
and each column in a table represents a particular quality or trait. Rows
and columns make up a table.
 Schema − A database schema outlines the logical organization and
structure of a database. The tables, connections between tables,
restrictions, and other information are all described. A schema outlines
the structure and storage requirements for the data. Let's look at an
illustration.
Assume we have an online storefront with the following tables −
Customers (Customer Id, Name, Email)
Orders (Order Id, Customer Id, Order Date, Total Amount)
Products (Product Id, Name, Price)
The tables, their columns, and any connections or restrictions between them
would all be specified by the schema.
 Query Language − : A query language enables users to access, manage,
and alter data from databases by sending queries. The most used query
language for relational databases is Structured Query Language (SQL).
For building, editing, and querying databases, it offers a set of commands
and syntax.
Database System Architecture

The general structure and parts of a database system are described by the
database system architecture. It includes the following essential elements −

 User Interface − Users can communicate with the database system using
the user interface. It could take the form of a web-based interface, a GUI,
or a command-line interface. Users may submit queries, enter data, and
see query results or reports via the user interface.
A web-based e-commerce program, for instance, may offer a user
interface that enables users to look for items, make orders, and check
their order histories.
 Query Processor − The query processor executes and optimizes SQL
queries after receiving them from users or applications. In order to get the
required data and carry out any necessary activities, it analyses the query,
chooses the most effective execution plan and communicates with other
components. In order to reduce resource consumption and boost speed,
the query processor makes sure that queries are processed as effectively
as possible.
 Storage Manager − Managing the actual physical storage of data on
discs or other storage media is the responsibility of the storage manager.
To read and write data, it communicates with the file system or storage
subsystem. To facilitate data access and guarantee data integrity, the
storage manager manages data archiving, retrieval .
For instance, the storage manager oversees the allocation of disc space to
guarantee effective storage when a new order is placed in the e-commerce
application. It also saves the order details in the relevant tables.
 Buffer Manager − Data transfer between memory and disc storage is
controlled by the buffer manager, an important component. It reduces
disc I/O operations and boosts efficiency by using a buffer cache to keep
frequently used data pages in memory. The buffer manager makes sure
that data caching and replacement procedures are effective in order to
maximize memory consumption.
For instance, when a query is run that needs to access data from the disc,
the buffer manager pulls the necessary data pages into the buffer cache
from the disc. The need for disc access can be avoided by serving
subsequent requests that access the same data from memory.
 Transactions Manager − Database transactions' atomicity, consistency,
isolation, and durability are all guaranteed by the transaction manager. To
maintain data integrity and concurrency management, it maintains
concurrent access to the data, takes care of transaction execution, and
enforces transaction isolation levels.
For instance, the transaction manager makes sure that each order is
executed as a separate transaction when several clients place orders at
once, ensuring data integrity and avoiding conflicts.
 Data Dictionary − The metadata regarding the database schema and
objects are stored in the data dictionary, sometimes referred to as the
metadata repository. It includes details on various database structures,
including tables, columns, data types, constraints, indexes, and more. The
DBMS uses the data dictionary to verify queries, uphold data integrity,
and offer details on the database structure
For instance, the data dictionary keeps tabs on the names, columns, data
types, and constraints of the tables in the e-commerce application.
 Concurrency Control − Multiple transactions can access and edit the
database simultaneously without resulting in inconsistent data thanks to
concurrency control methods. To regulate concurrent access and preserve
data integrity, methods including locking, timestamp ordering, and multi-
version concurrency control (MVCC) are utilized.
Concurrency control measures, for instance, make sure that two
consumers updating their profiles in the same e-commerce application at
the same time are serialized and applied appropriately to maintain data
consistency.
 Backup and recovery − In order to safeguard against data loss and
guarantee data availability, database systems must have backup and
recovery processes. In the case of system failures or data corruption,
recovery procedures are employed to restore the database to a consistent
condition. Regular backups are performed to create copies of the
database.
To guarantee that data can be restored in the event of hardware problems
or unintentional data loss, for instance, frequent backups of the e-
commerce database are made.

ER Model in DBMS
In Database Management Systems (DBMS), an Entity-Relationship (ER) model is
a conceptual data model used to represent the entities, their attributes, and
the relationships among them within a database. The ER model employs a
visual representation to describe the logical structure of a database in a clear
and understandable manner.
Components of the ER Model:
1. Entities:
 Represent real-world objects or concepts that have attributes. For
instance, in a university database, entities might include Student,
Course, Teacher, etc.
2. Attributes:
 Characteristics or properties of entities. For example, a Student
entity may have attributes like StudentID, Name, Age, etc.
3. Relationships:
 Associations between entities indicating how they are related to
each other. Relationships can be one-to-one, one-to-many, or
many-to-many.
Key Elements in ER Modeling:
1. Entity:
 Represented by rectangles in the ER diagram, containing the name
of the entity. Each entity has attributes that describe it.
2. Attributes:
 Represented within ovals or ellipses connected to the respective
entities. They describe the properties of the entities.
3. Relationships:
 Depicted by diamond shapes connecting related entities. The lines
between entities represent relationships, and the diamond shape
denotes the relationship type.
4. Cardinality and Multiplicity:
 Cardinality defines the number of occurrences of an entity
participating in a relationship (e.g., one-to-one, one-to-many,
many-to-many).
 Multiplicity specifies the exact number of instances in a
relationship.
Example of an ER Diagram:
Consider a simple ER diagram for a university database:

+------------+ +--------------+
| Student | 1 * | Course |
+------------+-------------+--------------+
| Student_ID | | Course_Code|
| Name | | Title |
| Age | | Credits |
+------------+ +--------------+

 Entities: Student and Course


 Attributes: Student_ID, Name, Age for Student entity; Course_Code,
Title, Credits for Course entity
 Relationship: One-to-Many relationship between Student and Course
(one Student can enroll in multiple Courses, but each Course can have
multiple Students)
Use of ER Models in DBMS:
 Database Design: Helps in designing the structure of the database,
defining entities, attributes, and relationships.
 Communication Tool: Facilitates communication between developers,
stakeholders, and users regarding the database structure and
requirements.
 Basis for Physical Database Design: Acts as a foundation for creating the
actual database schema in a DBMS.

You might also like