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).
💻 Live Code Editor
Is page ki language (MYSQL) mein code likhein aur turant chalाएं — yahीं, bina kuch install kiye.Powered by OneCompiler. Agar editor na khule to yahान naye tab mein kholein.
💻 Live Code Editor
Is page ke program yahan ready hain — chalाएं, badlें aur seekhें. Bina kuch install kiye.
Powered by OneCompiler. Editor mein code apne aap aa jata hai — Run dabaakर output dekhें.
Agar load na ho to naye tab mein kholें.