DBMS Schema
Schema
- It is a physical representation of data that appears in the database management system.
- In simple words, a schema is the structure of any database.
- It defines how the data is stored in a database and relationship among those data, but it does not show the data available in those tables.
- The database schema includes the definition of the database, record types (entities), and the components that make up those records.
- Schema of a database does not change by performing certain operations like insertion, updation, and deletion, but it can only be modified or changed by modifying the DDL statements.
- Database schema describes the integrity constraints of the database, domains of all attributes, foreign, and primary key of all the relations.
- Schema is of three types:
- Physical Schema: The overall design of a database at the physical level is called a physical schema. This schema describes how the data is stored in the secondary storage devices.
- Logical Schema: The overall design of a database at the logical level is called a logical schema. A database administrator (DBA) and the programmers used to work at this level.
- View Schema: The overall design of a database at a view level is called view schema. This schema generally describes the user’s interaction with the database system.
Example of Schema:
Subschema
- A subschema is the sub-level or subset of the schema having the same features that a schema has.
- This type of schema allows a user to view only that part of the database in which he is interested.
- A language called the SDL (Subschema Definition Language) is used to specify a subschema in a database management system (DBMS).
- For example: Suppose an employee table in a database where the programmer can access all fields of this table, but the user can access only two or three fields of it. Subschema describes both views of the database.
Instances
- The data or information stored in the database at a particular moment is called an instance of the database.
- An instance can also be called as a current state or database state.
- The database schema defines the variables in tables that belong to a specific database; the values or records of these variables at a particular moment are called the instance of the database.
- Many instances can be constructed to correspond to a specific database schema.
- Every time we insert, modify, or delete the value of data item in a record, one state of data changes into another state.
For Example: