0% found this document useful (0 votes)
54 views22 pages

Data Abstraction and 3-Tier Architecture

Uploaded by

rkmaharshi1108
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)
54 views22 pages

Data Abstraction and 3-Tier Architecture

Uploaded by

rkmaharshi1108
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/ 22

Subject Name: Database Management System

Data Abstraction and Data Independence


Points to be Discussed
 Data Abstraction
 Internal Level/Schema
 Conceptual Level/Schema
 Physical Level/Schema
 Data Independence
 Logical Data Independence
 Physical Data Independence
Data Abstraction:
 Database systems comprise of complex data-structures.
 In order to make the system efficient in terms of retrieval of data, and reduce
complexity in terms of usability of users, developers use abstraction i.e. hide
irrelevant details from the users. This approach simplifies database design.

There are mainly 3 levels of Data Abstraction:


1. Internal Level/Schema:
Actual PHYSICAL storage structure and access paths.
2. Conceptual Level/Schema or Logical Level/Schema:
Structure and constraints for the entire database
3. External Level/Schema or View level/Schema:
Describes various user views
Three Tier Architecture

Figure Reference: https://guru99.com


Internal Level/Schema (Physical Level/Schema)
 The internal schema defines the physical storage structure of the database.
 The internal schema is a very low-level representation of the entire database.
 It contains multiple occurrences of multiple types of internal record. In the ANSI term, it is
also called "stored record'.
Fact about Internal Level/Schema
 The internal schema is the lowest level of data abstraction.
 It helps you to keeps information about the actual representation of the entire database.
Like the actual storage of the data on the disk in the form of records
 The internal view tells us what data is stored in the database and how.
 It never deals with the physical devices. Instead, internal schema views a physical device
as a collection of physical pages
Conceptual Level/Schema (Logical Level/Schema)
 The conceptual schema describes the Database structure of the whole database for the
community of users. This schema hides information about the physical storage structures
and focuses on describing data types, entities, relationships, etc.
 This logical level comes between the user level and physical storage view. However, there
is only single conceptual view of a single database.
Fact about Conceptual Level/Schema
 Defines all database entities, their attributes, and their relationships
 Security and integrity information
 In the conceptual level, the data available to a user must be contained in or derivable from
the physical level
External Level/Schema (View Level/Schema)
 An external schema describes the part of the database which specific user is interested in.
It hides the unrelated details of the database from the user. There may be "n" number of
external views for each database.
 Each external view is defined using an external schema, which consists of definitions of
various types of external record of that specific view.
 An external view is just the content of the database as it is seen by some specific
particular user. For example, a user from the sales department will see only sales related
data.
Example of University Database at different levels
Consider an Example of a University Database. At the different levels this is how the
implementation will look like:

Type of Schema : Implementation


View/External Schema : View 1: Course info(cid:int,cname:string)
View 2: studeninfo(id:int. name:string)
Conceptual Schema : Students(id: int, name: string, login: string, age: integer)
Courses(id: int, cname.string, credits:integer)
Enrolled(id: int, grade:string)
Physical Schema : Relations stored as unordered files.
Index on the first column of Students.
Advantages of Database Schema
 You can manage data independent of the physical storage
 Faster Migration to new graphical environments
 DBMS Architecture allows you to make changes on the presentation level without
affecting the other two layers
 As each tier is separate, it is possible to use different sets of developers
 It is more secure as the client doesn't have direct access to the database business logic
 In case of the failure of the one-tier no data loss as you are always secure by accessing the
other tier
Disadvantages of Database Schema
 Complete DB Schema is a complex structure which is difficult to understand for every one
 Difficult to set up and maintain
 The physical separation of the tiers can affect the performance of the Database
Summary of Database Schema
 There are mainly three levels of data abstraction: Internal Level, Conceptual or Logical
Level or External or View level
 The internal schema defines the physical storage structure of the database
 The conceptual schema describes the Database structure of the whole database for the
community of users
 An external schema describe the part of the database which specific user is interested in
 DBMS Architecture allows you to make changes on the presentation level without
affecting the other two layers
Main Purpose of Database Schema
 The main purpose of data abstraction is achieving data independence in
order to save time and cost required when the database is modified or
altered.
 We have namely two levels of “data independence” arising from these
levels of abstraction :
 Physical Level Data Independence
 Logical Level Data Independence
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.
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.
Example 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
External views
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.
Example of changes under Logical Data Independence

Due to Logical independence, any of the below change will not affect
the external layer.
Add/Modify/Delete a new attribute, entity or relationship is possible
without a rewrite of existing application programs
Merging two records into one
Breaking an existing record into two or more records
Difference Between Logical and Physical
Logical Data Independence Physical Data Independence
Logical Data Independence is mainly concerned with Mainly concerned with the storage of the data.
the structure or changing the data definition.
It is difficult as the retrieving of data is mainly It is easy to retrieve.
dependent on the logical structure of data.
Compared to Logic Physical independence it is difficult Compared to Logical Independence it is easy to achieve
to achieve logical data independence. physical data independence.

Data Independence
You need to make changes in the Application program if A change in the physical level usually does not need
new fields are added or deleted from the database. change at the Application program level.
Modification at the logical levels is significant whenever Modifications made at the internal levels may or may
the logical structures of the database are changed. not be needed to improve the performance of the
structure.
Concerned with conceptual schema Concerned with internal schema
Example: Add/Modify/Delete a new attribute Example: change in compression techniques, hashing
algorithms, storage devices, etc
Importance of Data Independence

Helps you to improve the quality of the data


Database system maintenance becomes affordable
Enforcement of standards and improvement in database security
You don't need to alter data structure in application programs
Permit developers to focus on the general structure of the Database
rather than worrying about the internal implementation
It allows you to improve state which is undamaged or undivided
Database incongruity is vastly reduced
Easily make modifications in the physical level is needed to improve
the performance of the system
Summary of Data Independence
 Data Independence is the 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.
 Two levels of data independence are 1) Physical and 2) Logical
 Physical data independence helps you to separate conceptual levels from the
internal/physical levels
 Logical Data Independence is the ability to change the conceptual scheme
without changing
 When compared to Physical Data independence, it is challenging to achieve
logical data independence
 Data Independence Helps you to improve the quality of the data
Let as see today’s lecture at a glance
 Data Abstraction
 Internal Level/Schema
 Conceptual Level/Schema
 Physical Level/Schema
 Data Independence
 Logical Data Independence
 Physical Data Independence
Thank you

You might also like