Open In App

Difference between Schema and Instance in DBMS

Improve
Improve
Like Article
Like
Save
Share
Report

“Schema” and “Instance” are key ideas in a database management system (DBMS) that help organize and manage data. Let’s begin by examining their distinctions from one another.

Instances

An Instance is the state of an operational database with data at any given time. It contains a snapshot of the database. The instances can be changed by certain CRUD operations, such as like addition, and deletion of data. It may be noted that any search query will not make any kind of changes in the instances. 

Example:
Let’s say a table teacher in our database whose name is School, suppose the table has 50 records so the instance of the database has 50 records for now and tomorrow we are going to add another fifty records so tomorrow the instance has a total of 100 records. This is called an instance. 

Schema

Schema is the overall description of the database. The basic structure of how the data will be stored in the database is called schema.

Schema dia.

Schema

Schema is of three types: Logical Schema, Physical Schema and view Schema. 

  • Logical Schema – It describes the database designed at a logical level.
  • Physical Schema – It describes the database designed at the physical level.
  • View Schema – It defines the design of the database at the view level.
     

Example:
Let’s say a table teacher in our database named school, the teacher table requires the name, dob, and doj in their table so we design a structure as:  

Teacher table
name: String
doj: date
dob: date

Above given is the schema of the table teacher. 

Difference Between Schema and Instance

Schema Instance
It is the overall description of the database. It is the collection of information stored in a database at a particular moment.
The schema is same for the whole database. Data in instances can be changed using addition, deletion, and updation.
Does not change Frequently. Changes Frequently.
Defines the basic structure of the database i.e. how the data will be stored in the database. It is the set of Information stored at a particular time.

Conclusion

In short, the schema is the blueprint of the database, while the instance is the actual data that is in the database. The schema is the database’s design, and the instance is the data it contains.

When you change the schema, you change the structure of the database. When you change the instance, you change the data content.


Last Updated : 11 Oct, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads