Instances, Schema and Sub Schema In DBMS With Examples
If you are interested in learning about Instances,Schema and Subschema in DBMS? You are absolutely at the right place.
Instances in DBMS
In simple words, it is the snapshot of the database taken at a particular moment. It can also be described in more significant way as the collection of the information stored in the database at that particular moment. Instance can also be called as the database state or current set of occurrence due the fact that it is information that is present at the current state.
Every time we update the state say we insert, delete or modify the value of the data item in the record, it changes from one state to other. At the given time, each schema has its own set of instances.
Lets take an example to understand in a much better way,
An organization with an employees database will have three different instances such as production that is used to monitor the data right at that moment, per-production that is used to test new functionality prior to release of production and the development that is used by database developers to create new functionality.
Schema in DBMS
It is the overall description or the overall design of the database specified during the database design. Important thing to be remembered here is it should not be changed frequently. Basically, it displays the record types(entity),names of data items(attribute) but not the relation among the files.
Interesting point is the values in schema might change but not the structure of schema.
To understand it well, Schema can be assumed as a framework where in the values of data items are to be fitted, these values can be changed but not frame/format of the schema.
Consider the below two examples of schema for database stores and discounts
The former example shows the schema for stores displaying the name of the store, store id,address,city and state in which it is located and the zip code of respective location.
The latter example is all about schema of discounts that clearly shows the type,id and quality,thus we can now relate to the fact that schema only displays the record types (entities) and names of data items(attributes) but does not show the relation among the files.
Schema can be partitioned as logical schema and physical schema.
Look at the below diagram
Here,former part shows the logical schema which is concerned with the data structure with exploring data structure offered to DBMS so that schema is very easy for the computer to understand.
The latter part that is the physical schema is concerned with the way or the manner in which conceptual database gets represented in the computer as it is stored in the database.Physical schema is hidden behind the logical schema and thus can be be modified without affecting the application programs
Database management system provides data definition language(DDL) and document schema definition language(DSDL) to specify both logical and physical schema.
Sub schema in DBMS
It can be defined as the subset or sub-level of schema that has the same properties as the schema. In simple words it is just a effective plan or the schema for the view. Well, it is interesting to note that it provides the users a window through which the user can view only that part of database which is of matter of interest to him. It Identifies subset of areas, sets, records, data names defined in database that is of interest to him. Thus a portion of database can be seen by application programs and different application programs has different view of data.
Quickly we can summarize the above things, information/data in database at particular moment is known as instance,physical arrangement of data as it appears in database can be defined as schema, and the logical view of data as it appears to the application can be called as sub schema.
And that brings me to the end of the topic. If you have any doubts then please comment below.