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

Dbms Unit II

Download as docx, pdf, or txt
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 17

DBMS UNIT II

DBMS ARCHITECTURE: SCHEMA, SUBSHEMA, INSTANCE,DATABASE


ARCHITECTURE, DATABASE INDEPENDENCE, MAPPING,DATA
MODELS,TYPE OF DATABASE SYSTEM

What is database architecture?


The term "database architecture" refers to the structural design and methodology of a database
change system, which forms the core of a Database Management System (DBMS). This architecture
dictates how data is stored, organized, and retrieved, playing a crucial role in the efficiency and
effectiveness of data management.

Database architecture describes how a database management system (DBMS) will be integrated
with your application. When designing a database architecture, you will make decisions that will how
your applications are created.

Database architectures can be classified into one-tier, two-tier, and three-tier


models, each serving different purposes based on the deployment of the
application and the database. Here’s an overview of each architecture type:

Data architecture_

One_tier architecture

Two_tier architecture

Three_ tier architecture

### 1. **One-Tier Architecture**

- **Description**: In a one-tier architecture, the database and the client


application reside on the same machine. This means that the user interface
and database management are both handled locally. In one-tier architecture, the
database, user interface, and application logic all reside on the same machine or server. It's typically
used for small-scale applications where simplicity and cost-effectiveness are priorities. Because
there are no network delays involved, this type of tier architecture is generally a fast way to access
data.
- **Components**:

- **Client Application**: The application directly accesses the database.

- **Database**: Local database storage (e.g., desktop applications).

- **Advantages**:

- Simplicity: Easy to develop and deploy.

- Performance: Fast data access since everything is on a single machine.

- **Disadvantages**:

- Scalability: Limited scalability; performance degrades as the number of


users increases.

- Maintenance: Difficult to maintain and update across multiple machines.

### 2. **Two-Tier Architecture**

- **Description**: In a two-tier architecture, the client and server are


separated. The client application communicates directly with the database
server over a network. This is common in client-server applications. Two-tier
architecture consists of multiple clients connecting directly to the database. This tier architecture is
also known as client-server architecture.- This tier architecture used to be more common when a
desktop application would connect to a single database hosted on an on-premise database server —
for example, an in-house customer relationship management (CRM) that connects to an Access
database.*
*Components**:

- **Client Layer**: The front-end application (user interface) that interacts


with the users.

- **Server Layer**: The back-end database server that processes queries


and manages data.

- **Advantages**:

- Improved Performance: Offloads processing to the server, reducing client


load.

- Better Resource Management: Easier to manage resources and update the


server independently.

- **Disadvantages**:

- Scalability: Limited scalability; as user load increases, the server may


become a bottleneck.

- Network Dependency: Performance is dependent on network reliability and


speed.

### 3. **Three-Tier Architecture**

- **Description**: In a three-tier architecture, there is an additional layer (middle tier) that acts
as an intermediary between the client and the database server. This architecture is common in
web applications and enterprise systems. Most modern web applications use a three-tier
architecture. In this architecture, the clients connect to a back end, which in turn connects to the
database. Using this approach has many benefits:

 Security: Keeping the database connection open to a single back end reduces the risks of
being hacked.
 Scalability: Because each layer operates independently, it is easier to scale parts of the
application.
 Faster deployment: Having multiple tiers makes it easier to have a separation of concerns
and to follow cloud-native best practices, including better continuous delivery processes.

- **Components**:

- **Presentation Layer (Client Tier)**: The user interface, often a web


browser or application that presents data to the user.

- **Application Layer (Middle Tier)**: The business logic and application


server that processes user requests and communicates with the database. It
handles data processing and manages the logic of the application.

- **Data Layer (Database Tier)**: The database server where data is stored,
retrieved, and managed.

- **Advantages**:

- Scalability: Better scalability; the middle tier can be scaled independently


to handle increased loads.

- Security: Improved security; the middle tier can provide a layer of security
between the client and database.

- Flexibility: Easier to update or modify components independently without


affecting others.

- **Disadvantages**:
- Complexity: More complex to develop and maintain due to the additional
layer.

Schema, subshema, instance

Database Schema
A database schema is the skeleton structure that represents the logical view of
the entire database. It defines how the data is organized and how the relations
among them are associated. It formulates all the constraints that are to be
applied on the data.
A database schema defines its entities and the relationship among them. It
contains a descriptive detail of the database, which can be depicted by means
of schema diagrams. It’s the database designers who design the schema to help
programmers understand the database and make it useful.

A database schema can be divided broadly into two categories −


 Physical Database Schema − This schema pertains to the actual
storage of data and its form of storage like files, indices, etc. It defines
how the data will be stored in a secondary storage.
 Logical Database Schema − This schema defines all the logical
constraints that need to be applied on the data stored. It defines tables,
views, and integrity constraints.

Subschema
Subschema is a sub part of a schema and inherits same properties of schema.
Subschema describes different view of the database. Subschema is an application
programmer’s or user view of data item types and records type.

For example: Suppose a table employee, programmer has access of all columns of table
employee but user has access of only two or three columns of table employee.
Subschema describes different view of the database.
Database Instance

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

called database instance. Database changes every time when information is inserted
and deleted to/from database. A database schema is variable declarations in a program.
Variable has particular value at a given instant. Then, the value of variable at particular
instant is called database instance.

Data Independence
o Data independence can be explained using the three-schema
architecture.
o Data independence refers characteristic of being able to modify the
schema at one level of the database system without altering the
schema at the next higher level.
There are two types of data independence:

1. Logical Data Independence


o Logical data independence refers characteristic of being able to
change the conceptual schema without having to change the external
schema.
o Logical data independence is used to separate the external level from
the conceptual view.
o If we do any changes in the conceptual view of the data, then the user
view of the data would not be affected.
o Logical data independence occurs at the user interface level

2. Physical Data Independence


o Physical data independence can be defined as the capacity to change
the internal schema without having to change the conceptual schema.
o If we do any changes in the storage size of the database system
server, then the Conceptual structure of the database will not be
affected.
o Physical data independence is used to separate conceptual levels from
the internal levels.
o Physical data independence occurs at the logical interface level.
Fig: Data Independence
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.
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.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.
the object-oriented approach were developed. Here, the objects are
nothing but the data carrying its properties.
Mapping (Cardinality) in DBMS
Cardinality means how the entities are arranged to each other or what is
the relationship structure between entities in a relationship set. In a
Database Management System, Cardinality represents a number that
denotes how many times an entity is participating with another entity in a
relationship set.
Cardinality ratio is also called Cardinality Mapping, which represents
the mapping of one entity set to another entity set in a relationship set.
There are four types of Cardinality Mapping in Database Management
Systems:
1. One to one
2. Many to one
3. One to many
4. Many to many

One to One

One to one cardinality is represented by a 1:1 symbol. In this, there is at


most one relationship from one entity to another entity. For
example, one student can have only one student id, and one student id
can belong to only one student. So, the relationship mapping between
student and student id will be one to one cardinality mapping.
Many to One Cardinality:
In many to one cardinality mapping, from set 1, there can be multiple sets that
can make relationships with a single entity of set 2. Or we can also describe it as
from set 2, and one entity can make a relationship with more than one entity of
set 1.
One to one Cardinality is the subset of Many to one Cardinality. It can be
represented by M:1.
One to Many Cardinalities:
In One-to-many cardinality mapping, from set 1, there can be a maximum single
set that can make relationships with a single or more than one entity of set 2. Or
we can also describe it as from set 2, more than one entity can make a
relationship with only one entity of set 1.
One to one cardinality is the subset of One-to-many Cardinality. It can be
represented by 1: M.

Many to Many Cardinalities:

In many, many cardinalities mapping, there can be one or more than one entity
that can associate with one or more than one entity of set 2. In the same way
from the end of set 2, one or more than one entity can make a relation with one
or more than one entity of set 1.
It is represented by M: N or N: M
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. It
comforts the users to access the stored data from different locations through
several applications. These applications contain the authentication process to let
users access data securely

Advantages of Centralized Database

o It has decreased the risk of data management, i.e., manipulation of


data will not affect the core data.
o Data consistency is maintained as it manages data in a central
repository.
o It provides better data quality, which enables organizations to establish
data standards.
o It is less costly because fewer vendors are required to handle the data
sets.

Disadvantages of Centralized Database


o The size of the centralized database is large, which increases the
response time for fetching the data.
o It is not easy to update such an extensive database system.
o If any server failure occurs, entire data will be lost, which could be a
huge loss.

2) Distributed Database
a centralized database system, in distributed systems, data is distributed
among different database systems of an organization. These database
systems are connected via communication links. Such links help the end-
users to access the data easily

Advantages of Distributed Database


o Modular development is possible in a distributed database, i.e., the
system can be expanded by including new computers and connecting
them to the distributed system.
o One server failure will not affect the entire data set.

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). Each table in the database carries a key that makes the
data unique from others.

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.

Hierarchical Databases
It is the type of database that stores data in the form of parent-children
relationship nodes. Here, it organizes data in a tree-like structure.

Data get stored in the form of records that are connected via links. Each child
record in the tree will contain only one parent. On the other hand, each parent
record can have multiple child records.

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.
Unlike the hierarchical database, it allows each record to have multiple children
and parent nodes to form a generalized graph structure.

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

You might also like