The database consists of different objects like schema, tables, views, constants, cursors, procedures, functions, packages, synonyms, etc. They have their specifications, tasks, and value in the database. But they all differ from what we see on the monitor. i.e.; what we see on the monitor is the user-friendly display of the data. But actual structure and data are stored in different ways.
There is storage information about the data, object structure. There is basic information about the objects like their names, columns in them, a total number of records, their indexes, and constraints, the mapping between the tables, functions/procedures used in packages, etc. There are exact values for each record that are shown to the user. All these information are different from each other in their own way. Let us see all of them
Each data value and structure details of the database objects are stored in magnetic tapes, magnetic disks, optical disks, etc. This information is usually the basic storage information of any computer. This kind of information is called physical storage information and is usually the lowest level of information. They are least known to any programmer. This is called the physical level of data.
The information like table/view names, their columns, indexes, and constraints on them, the mapping between the tables are all next level of information related to the database. This information defines the structure of the objects in the database. These are all called logical levels of data. The developer and the DBA will have knowledge about this data.
The user will get to see only the data stored in the database. Either they will see whole data values or any specific records. They will not have any information about how they are stored, what kind of datatype it has, how many records it has etc. This level of abstraction is called a view level.
In a STUDENT table example, records of each student which user sees are view level of information. Columns, their data types, their mapping, and constraints like primary key, foreign key information are the logical level of information. The actual structure of the table and data are stored in the server’s memory. This is the physical level of information.
The physical level of abstraction is the lowest level of abstraction and the view level of abstraction is the highest level of abstraction. Based on these levels of abstraction, we have two types of data independence.
Suppose there was a change in the memory size of the database servers. This will not affect the logical structure of any of the objects in the database. They are completely independent of the physical structure. This is called physical data independence.
Any changes to the database objects like changes to the table structure, size, or addition/removal of columns from the table will not affect user views. They will see the data like before. This is called logical data independence.
By these two types of data independence, the isolation between the physical and logical layer is achieved. This helps in reducing the time and cost acquired by changes in any one level in the database. Hence, the main purpose of the database to provide an abstract view of data is achieved.