Short Notes on Schema, Sub-schema, Instances, Data Independence
A schema is plan of the database that give the names of the entities and attributes and the relationships among them. A schema includes the definition of the database name, the record type and the components that make up the records. Alternatively it is defined as a framework into which the values of the data items are fitted. The values fitted into the frame work changes regularly but the format of schema remains the same. The values fitted into the framework changes regularly but the format of schema remains the same. e.g. consider the database consisting of three files ITEM, CUSTOMER and SALES. The data structure diagram for this schema is shown below:
Types of Schema
Generally, a schema is of two types.
- Physical Schema
It is concerned with the manner in which the conceptual database get represented in the computer as a stored database. It is hidden behind the logical schema and can usually be modified without affecting the application programs.
- Logical Schema
It is concerned with exploiting the data structures offered by the DBMS so that the schema becomes understandable to the computer. It is important as programs use it to construct applications.
A sub-schema is a subset of the schema having the same properties that a schema has. It identifies a subset of areas, sets, records and data names defined in the database schema available to user sessions. The sub-schema allows the user to view only that part of the database that is of interest to him.
The data in the database at a particular moment of time is called an instance or a database state. In a given instance each schema construct has its own current set of instances. Everytime we update the value of a data item in record, one state of the database changes into another state. The Figure 1.6 shows an instance of the ITEM relation in a database schema.
Data independence can be defined as the capacity to change the schema at one level of a database system without having to change the schema at the next higher level .It is of following two types:
- Logical data Independence
Logical data independence is the ability to modify the conceptual scheme without making it necessary to rewrite application programs. It states that changes at the logical level (tables, columns, rows) will have no impact in the applications that access the database. We may change the conceptual schema to expand the database (by adding a record type or data item), or to reduce the database (by removing a record type or data item).
- Physical data independence
Physical data independence is the ability to modify the physical scheme without making it necessary to rewrite application programs. Changes to the internal schema may be needed because some physical files had to be reorganised – for example, by creating additional access structures – to improve the performance of retrieval or update. If the same data as before remains in the database, we should not have to change the conceptual schema.