A database schema and a database instance are fundamental concepts in database management systems (DBMS). Let’s define each term:

1. Database Schema:

  1. The overall design of a database is called schema.
  2. It represents the logical view of the entire database.
  3. A schema contains schema objects like table, foreign key, primary key, views, columns, data types, stored procedure, etc.
  4. The basic structure of how the data will be stored in the database is called schema. Types of Schema
  5. Physical schema
    1. It is a database design at the physical level.
    2. It is hidden below the logical schema and can be changed easily without affecting the application programs.
  6. Logical schema − It is a database design at the logical level. Programmers construct applications using logical schema.
  7. External − It is schema at view level. It is the highest level of a schema which defines the views for end users.

2. Database Instance

  • At a particular moment the data stored in database is called the instance,
  • this changes over time as and when we add, delete or update data in the database.
    1. The data which is stored in the database at a particular moment of time is called an instance of the database.
    2. The instances can be changed by certain operations as like addition, deletion of data.
    3. Database schema defines the attributes in tables that belong to a particular database.
    4. The value of these attributes at a moment of time is called the instance of that database.
    5. Example:
      1. We have a single table student in the database, today the table has 100 records, and so today the instance of the database has 100 records.
      2. We are going to add another 100 records in this table by tomorrow so the instance of database tomorrow will have 200 records in table.