MySQL + SQL · Lesson 15
Schema and Instance in DBMS
Schema vs Instance
Schema is the overall design/structure of a database (the tables and their columns). Instance is the actual data present in the database at a particular moment. Schema is like an empty form; instance is the filled form.
Key Difference
| Schema | Instance |
|---|---|
| Design/structure of database | Data at a given time |
| Changes rarely | Changes often (every insert/update) |
| Defined at design time | Exists at runtime |
Example
-- SCHEMA (structure)
CREATE TABLE students (roll_no INT, name VARCHAR(50), marks INT);
-- INSTANCE (data right now)
1, Aman, 88
2, Riya, 91The CREATE TABLE is the schema. The two rows are the current instance.
Summary
- Schema = structure/design (stable).
- Instance = actual data at a moment (changes constantly).