Tuesday, January 29, 2019

Schema, Subschema and Instance

Schema:
Design of a database is called the schema. A database schema is the skeleton structure that represents the logical view of the entire database. It defines how the data is organized and how the relations among them are associated. It is the collection of named objects. The schema contains names of tables, columns of each table, datatype, triggers, functions, views, stored procedures and other objects are included in the schema. A database schema can be represented by using the visual diagram. That diagram shows the database objects and relationship with each other. A database schema is designed by the database designers to help programmers whose software will interact with the database. The process of database creation is called data modeling. The changes in a schema are not applied so frequently, but occasionally changes need to be applied as the requirements of application changes.
         For Example: In the following diagram, we have a schema that shows the relationship between three tables: Course, Student and Section. The diagram only shows the design of the database, it doesn’t show the data present in those tables. Schema is only a structural view (design) of a database as shown in the diagram below.
Schema is of three types: Physical schema, logical schema and view schema.
              The design of a database at physical level is called physical schema. It describes how the data stored on the disk or the physical storage.
           Design of database at logical level is called logical schema, programmers and database administrator work at this level. At this level data can be described as certain types of data records gets stored in data structures.
               Design of database at view level is called view schema. This generally describes end user interaction with database systems.
Subschema:
            A subschema provides a view of the database as seen by an application program. This view is often a subset of the complete schema definition. A subschema is used at run time to provide the DBMS with a description of those portions of the database that are accessible to the application program. The subschema allows the user to view only that part of the database that is of interest to him. The subschema defines the portion of the database as seen by the application programs and the application programs can have different view of data stored in the database.
              The subschema identifies the areas, records, elements, and sets which are accessible. The subschema identifies the Data Manipulation Language (DML) functions which can be performed. The different application programs can change their respective subschema without affecting other's subschema or view.
Instance:
         The data stored in database at a particular moment of time is called instance of database. It is a snapshot where the current state or occurrence of a database is framed at that moment. Database schema defines the variable declarations in tables that belong to a particular database; the value of these variables at a moment of time is called the instance of that database. Instance changes very frequently, whenever data is removed or added in the database.
              For example: We have a table student in the database, today the table has 10 records, so today the instance of the database has 10 records. We are going to add another 10 records in this table by tomorrow so the instance of database tomorrow will have 20 records in table. In short, at a particular moment the data stored in database is called the instance, that changes over time when we add or delete data from the database.
Difference between Schema and Instance:
  • A schema is the design representation of a database whereas instance is the snapshot of a database at a particular moment.
  • Instance changes very frequently, whenever data is removed or added in the database. As against, the changes in schema occurs rarely.
-profshardulp.patil@gmail.com

1 comment: