A data model is a set of ideas for describing how data is organised, connected and constrained. Choosing a model decides how you think about the database before any table is created.
What a data model gives you
A data model describes three things: the structure of the data (what is stored), the relationships between items, and the constraints (rules that data must obey). It lets designers and users talk about the same design without worrying about disk files.
Definition: Data model. A collection of concepts for describing the structure of a database, its relationships and its constraints.
Types of data models
Hierarchical model
Data forms a tree. Each record has one parent but can have many children. A college has departments, each department has courses. It is fast for fixed top-down paths, but a record that belongs to two parents (a teacher shared by two departments) is awkward.
Network model
Data forms a graph. A record can have many parents and many children, so many-to-many links are possible. It is more flexible than the tree but harder to design and to query, because you follow links by hand.
Relational model
Data is stored in tables (relations) made of rows and columns. Tables are connected by matching values, not by pointers. It is simple, has a strong mathematical base and a standard query language (SQL), so it is the most widely used model today.
Object-oriented model
Data is stored as objects, with attributes and methods, in classes that can inherit from each other. It suits complex data such as CAD drawings, multimedia and software design tools.
Comparison
| Model | Structure | Links | Typical use |
|---|---|---|---|
| Hierarchical | Tree | Parent to child | Old mainframe systems, file directories |
| Network | Graph | Many to many by pointers | Telecom, early large systems |
| Relational | Tables | Matching key values | Banks, colleges, shops |
| Object-oriented | Objects and classes | References between objects | CAD, multimedia |
Why data models matter in a DBMS
- They give a common language for designers, programmers and users.
- They separate the logical design from physical storage, so storage can change without rewriting programs.
- They let the DBMS enforce rules such as keys and constraints.
- A good model makes later changes cheaper.
Worked example
Take students and the courses they enrol in. A student takes many courses and a course has many students. The hierarchical model cannot show this cleanly, since a course would repeat under each student. The network model can link them directly. The relational model uses three tables: student, course and enrolment(student_id, course_id), which is simple and easy to query.
Common mistakes
- Thinking the relational model uses pointers. It connects tables only by matching values.
- Mixing up the hierarchical model (one parent) with the network model (many parents).
Practice questions
- What is a data model? Why is it important?
- Name the four types of data models.
- Differentiate hierarchical and network models.
- Why is the relational model the most popular?
- Give one use of the object-oriented model.
Answers to the practice questions
- A set of concepts to describe structure, relationships and constraints of data. It gives a common language and separates logical design from storage.
- Hierarchical, network, relational and object-oriented.
- Hierarchical: tree, one parent per record. Network: graph, a record may have many parents.
- Simple table structure, strong theory and a standard language, SQL.
- Storing complex data such as CAD designs or multimedia.
Sources
- Official BCA syllabus Database Management Systems, course code CC202, Unit I
- Raghu Ramakrishnan and Johannes Gehrke, Database Management Systems, 3rd edition, McGraw-Hill
