Data Model is a collection of concepts (fundamental building blocks or general notions) that can be used to describe the structure of a database. Thus, it provides necessary means(ways) to achieve data abstraction (easy to understand for different classes of peoples: naive users, query executors, etc.)
The structure of a database implies data types, relationships, and constraints(restrictions) that apply to data that is stored.
🗯 In simple words, a data model helps us represent data using simple concepts( say objects, attributes, tables, etc.) so that the intended audience can work on it.
Depending on the audience, we may need a different level of abstractions. Let me give you a real-world scenario,
Say you are hired as a database designer for your nearest shopping mall. Now you are going to perform requirement analysis to determine the structure of the database. After all the hardship, you will be needed to explain your database to the manager of the mall right? To him, you cannot talk about how SQL works, neither you can talk about how the data is stored physically! He will be flabbergasted.
⛑ To avoid the above situation, a better thing would be to explain to him in form of some diagrams/pictures so that he can understand and provide feedback for further iterations of the design.
Depending on the type of the audience, we can model the data into 3 different ways,
- Hight Level or Conceptual Model
- The highest level of abstraction is provided.
- Used for modeling data for naive users.
- we use diagrams or visuals to explain our database.
- Example: Entity-Relationship(ER) model.
- Representational/Implementation/Logical Model
- Less abstraction compared to Conceptual Model.
- To execute queries, we need to understand this model.
- Intended for programmers who are query executors.
- Example: Relational Model, Object-Oriented Model.
- Physical Model
- The lowest level of abstraction.
- To understand how the data is stored in the memory, we need to understand this model.
- Intended for computer specialists as it talks about low-level details.