A data model is a set of tools (concepts) used to describe the structure of a database. It tells us:
- What the data is
- How different pieces of data are related to each other
- What the data means (semantics)
- What rules (constraints) apply to the data
A data model helps us design a database at the conceptual level, logical level, and physical level.
Types of Data Models
1. Hierarchical Model
- Data is arranged in a tree-like structure.
- There is one root, and then parent-child relationships.
- Each child has only one parent (this is called a one-to-many relationship).
- Example: An organization chart, with departments and their employees.
2. Network Model
- This is an improved version of the hierarchical model.
- Here, a child can have more than one parent. So instead of a strict tree, it forms a graph-like structure.
- It uses pointers/links to support many-to-many relationships.
3. Relational Model
- Data is stored in tables, called relations.
- Each table has rows (called tuples) and columns (called attributes).
- Tables are connected to each other using common columns, called keys.
- This is the most popular model used today. It is implemented by DBMS software like MySQL, Oracle, and PostgreSQL.
4. Entity-Relationship (E-R) Model
- This is a high-level, conceptual model used mainly for designing a database before building it.
- It shows the database as a collection of:
- Entities (real-world objects, like Student or Course)
- Attributes (properties of entities, like Name or RollNo)
- Relationships (how entities are connected)
- It is represented using E-R diagrams, and is usually converted into a relational model later.
5. Object-Oriented Model
- Data is stored as objects, just like in object-oriented programming.
- Each object combines data and the methods (functions) that work on that data, into one single unit.
- It supports OOP concepts like inheritance, encapsulation, and polymorphism.
- Useful for handling complex data, like in CAD software or multimedia applications.