Course contentsShow
← Computer Science
Lesson 1553 of 2,87236. Database FundamentalsFree lesson

Schemas and Instances

Distinguishing between a database schema (structure definition) and a database instance (actual data at a point in time).

Schemas and Instances

What You'll Learn

You'll learn to distinguish between a database schema—the blueprint of how data is organized—and a database instance—the actual data stored at any given moment.

The Core Idea

In the relational model, it's crucial to separate structure from content.

Schema is the structure definition of your database. It describes:

  • What tables exist
  • What columns each table has
  • The data types of those columns
  • Constraints and relationships

Think of a schema as an architectural blueprint for a house—it shows where the rooms are, their dimensions, and how they connect, but it doesn't tell you what furniture is inside.

Instance is the actual data stored in the database at a specific point in time. It's the set of rows currently living in your tables. The instance changes constantly as you insert, update, or delete data.

Using the house analogy: the instance is the actual furniture, decorations, and people in the house right now. Tomorrow, someone might move the couch or add a new lamp—the instance changes, but the blueprint (schema) stays the same.

Example

Schema (unchanging structure):

Students table:
- student_id (integer)
- name (text)
- enrollment_date (date)

Instance (current data, changes over time):

| student_id | name      | enrollment_date |
|------------|-----------|-----------------|
| 101        | Alice     | 2024-01-15      |
| 102        | Bob       | 2024-01-20      |

Tomorrow, if Charlie enrolls, the instance changes (new row added), but the schema remains identical.

Key Takeaway: The schema defines the fixed structure and rules of your database tables, while the instance is the snapshot of actual data stored at any moment—schemas are stable blueprints, instances are dynamic content.