Schema — The Blueprint
A schema is the structure of the database — the design, not the data.
Think of it as the blueprint of a building. It defines what tables exist, what columns each table has, what data types they use, and how tables relate to each other.
🧱 Example:
CREATE TABLE Users (
id INT PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(100)
);This table definition is part of the database schema.
💡 Characteristics:
-
Defined once and rarely changes
-
Describes the structure of data
-
Stored in the system catalog
🧠 Interview Line:
“The schema is the database’s structure, the instance is the actual data at a specific moment, and a subschema is a user-specific view of part of the schema for abstraction and access control.”