Database consists on 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 way.
There are storage informations about the data, object structure. There are basic informations about the objects like their names, columns in them, total number of records, their indexes and constraints, mapping between the tables, functions/procedures used in packages etc. There are exact values for each record which are shown to the user. All these informations 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. These informations are usually the basic storage information of any computer. This kind of informations is called physical storage information and is usually lowest level of informations. They are least known to any programmer. This is called physical level of data.
The informations like table/view names, their columns, indexes and constraints on them, mapping between the tables are all next level of information related to 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 the 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 view level.
In a STUDENT table example, records of each student which user sees are view level of information. Columns, their datatypes, their mapping, and constraints like primary key, foreign key informations are the logical level of information. The actual structure of table and data are stored in the server’s memory. This is physical level of informations.
Physical level of abstraction is the lowest level of abstraction and 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 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 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 database to provide abstract view of data is achieved.