Data Models, Schemas and Instances
Data Models, Schemas and Instances
1. Data Abstraction
In databases, data abstraction means hiding the complex details of how data is stored and focusing only on what is important. Different users can view data at different levels of detail depending on their needs.
2. Data Models
A data model is a collection of concepts used to describe the structure of a database.
It defines:
-
Data types
-
Relationships among data
-
Constraints on data
-
Operations for accessing and updating data
Data models help us understand and design databases without worrying about low-level storage details.
Categories of Data Models
a) High-level / Conceptual Data Models
-
Close to how users think about data.
-
Use concepts like entities, attributes, and relationships.
-
Example: ER (Entity–Relationship) Model.
b) Representational (Implementation) Data Models
-
In between conceptual and physical models.
-
Easy for users to understand but still close to how data is stored.
-
Examples:
-
Relational model (most widely used)
-
Legacy models: hierarchical, network
-
c) Physical Data Models
-
Show how data is actually stored on disk (files, indexes, record formats).
-
Used by system designers, not end users.
-
Include concepts like access paths, hashing, indexing.
d) Self-describing Data Models
-
Store data and its description together.
-
Examples: XML, many NoSQL databases.
3. Schemas and Instances
Schema(Intension)
-
The description/blueprint of the database.
-
Defines the structure:
-
What tables/objects exist
-
What attributes they have
-
Constraints
-
-
Created during database design and does not change frequently.
-
A schema diagram shows the structure but not the actual data.
Example: STUDENT(Name, Student_number, Major)
This is a schema construct.
Instance (Database State-Extension)
-
The actual data stored in the database at a given moment.
-
Changes frequently as data is inserted, deleted, or updated.
-
Also called the snapshot or extension of the database.
Example:
A record like:
(John, 101, CS)
This is an instance of the STUDENT schema.
Summary of Differences
| Schema | Instance / Database State |
|---|---|
| Logical design of the database | Actual contents at a specific time |
| Rarely changes | Changes frequently |
| Like a blueprint | Like the building at any moment |
| Stored in the DBMS catalog (metadata) | Stored as data records |
Comments
Post a Comment