What is Schema, 3 schema architecture     
                   and data independence in DBMS?

What is Schema, 3 schema architecture and data independence in DBMS?

What you will get from this blog post ?

If you are struggling to understand what is a schema, 3 schema architecture ( 3 layers of data abstraction), and data independence, then you are at the right place because after this blog post you will be clear with 2 questions

  1. What is schema in a database management system?
  2. What are the various schemas (layers) of 3 schema architectures?
  3. What is data independence in database management systems ?

So without any further due let's jump straight into the content

What is schema in a database management system?

In simple words, a schema is basically the skeleton of the database which provides us the logical representation of the entire database by defining how the data will be stored, what would be the attributes of that data, what would the datatype of those attributes, how those attributes will be related to other attributes, and what would be the logical constraints to be applied on the data.

Now taking about the schema itself there are basically 3 different parts also known as the 3 different layers of data abstraction database management system.

  1. View Schema
  2. Logical Schema
  3. Physical Schema

What is the overall structure of the 3 schema architecture?

In 3 schema architecture which is also known as 3 layers of data abstraction, first of all, we have View schema, after which there comes logical schema following which there is physical schema and at last, there is the database management system.

image.png

Now let's discuss each and every schema of 3 schema architecture

View Schema

View schema ( External schema ) is basically the top most part of 3 schema architecture and it is used to represent or define how the data will be presented to the end user ( client ) .For example : let us suppose that there is student in the university and he wants check his marks in last semester examinations , so for that when the student will fill his Universtiy Id and his roll number on the university website then what details ( data ) will be presented to the student , all of these kinds of details are defined at view schema database .

One additional thing about view schema which you must know is that there are usually multiple view schemas in 3 schema architecture of database and the reason behind it is that usually there are multiple individuals who differ in hierarchy but access the same database so for that reason in case we will not make multiple views then all those individuals will get access to same data irrespective of hierarchy, which must not be the case ( Example university ) thus in order to define the visibility of data as per the hierarchy we make multiple view schemas ( also known as sub-schemas ).

Logical Schema

Logical schema ( conceptual schema ) is the middle layer or part of 3 schema architecture and it is used to define what would be the attributes of the data, what would the datatype of those attributes, and how those attributes will be related to each other, and what would be the logical constraints that are to be applied on the data.

Physical Schema

Physical schema ( internal schema ) is the last layer of part of 3 schema architecture and it is used to define how the data will be stored in secondary storage ( like in terms of bytes, gigabytes, terabytes, files or folders, etc) . In addition to it physical schema also defines which data structure is being used to store the data and where the data will be stored like whether it will be centralized or decentralized.

What is data independence ?

The basic intuition behind data independence is that if the end user makes any change at any level of 3 schema architecture then that change must not affect the schema present at its highier level .

There are basically 2 types of data independence

Physical data independence

Physical data independence is achieved when the change made by the end user at the physical level (like a change in the storage structure or change in files ) does not affect the logical schema and view schema above it.

Logical data independence

Logical data independence is achieved when the change made by the end user at the logical level (like a change in the attributes or logical constraints of data ) does not affect the view schema above it.

Did you find this article valuable?

Support Yuvraj Singh by becoming a sponsor. Any amount is appreciated!