Data Models
A Data Model in DBMS is a concept of tools that are developed to summarize the description of the database. It defines how the logical structure of a database is modeled. A Data Model is a collection of conceptual tools for describing:
⇒ Data
⇒ Data relationships
⇒ Data semantics
⇒ Consistency constraints
It describes the design of a database at each level of data abstraction. It defines how data is connected to each other and how they are processed and stored inside the system.
The most widely used model by commercial data processing applications. It uses a collection of tables to represent data and the relationships among those data.
Data is stored in tables called relations. Each table is a group of columns and rows, where columns represent attributes of an entity and rows represent records (or tuples).
Attribute or Field: Each column in a relation is called an attribute. The values of the attribute should be from the same domain.
Example: Attributes of a student might include Student-ID, Student-Name, and Student-Age.
Tuple or Record: Each row in the relation is called a tuple. A tuple defines a collection of attribute values, so each row in a relation contains unique values.
Example: Each row contains all the information about a specific individual, like a row for student Ashish.
This model was initially described by Edgar F. Codd in 1969.
Description: A high-level data model diagram. The ER model describes the structure of a database with the help of a diagram, known as the Entity-Relationship Diagram (ER Diagram). It is a design or blueprint of a database that can later be implemented as a database.
Components
1.Entities: Real-world objects, such as persons, places, or concepts.
Example: Teachers, Students, Courses, Buildings, Departments.
2.Attributes: Properties of entities.
Example: The entity "Teacher" has attributes like Teacher-ID, Name, Salary, Age.
3.Relationships: Connections between entities.
Example: A Teacher works for a Department.
The entities are Teacher and Department.
The attributes of Teacher entity are Teacher-Name, Teacher-id, Age, Salary, Mobile-Number.
The attributes of Department entity are Dept-id, Dept-name.
The two entities are connected using the relationship. Here, each teacher works for a department.
⇒ 1.Object-Oriented Data Model: An extension of the ER model with notions of functions, encapsulation, and object identity. Both data and relationships are present in a single structure known as an object. Objects are connected through links, which are used to relate one object to others.
⇒ Here, two obiects Employee and Department. All the data and relationships of each object are contained as a single unit. The attributes like Name, Job-title of the employee and the methods which will be performed by that object are stored as a single object.
The two objects are connected through a common attribute i.e. the Department-id and the communication between these two will be done with the help of this common id.
2.Object-Relational Data Model: A combination of the object-oriented data model and the relational data model. This model was built to bridge the gap between the object-oriented model and the relational model. It includes advanced features like complex data types that can be formed using existing data types. However, this model can get complex and difficult to handle, requiring a proper understanding.
Description: The semi-structured data model is an evolved form of the relational model. It allows data specifications where individual data items of the same type may have different sets of attributes. Some entities may have missing attributes, while others may have additional attributes that are not shared by all items. This model is flexible in representing complex and irregular data structures, which are not well-suited for the rigid schema of the relational model.
It Provides flexibility in storing data and attributes.
Example: An attribute can contain an atomic value or a collection of values.
Usage: The Extensible Markup Language (XML) is widely used for representing semi-structured data. In XML, tags and different markups are used to describe data.
Description: Data is organized into a tree-like structure with each record having one parent record and many children. This model can have only one-to-many relationships between nodes.
Drawback: It is rarely used now due to its limitations in handling complex relationships.
Example: A course assigned to a single student, while a student can take multiple courses (one-to-many relationship).
Description: An extension of the hierarchical model with a graph-like structure instead of a tree-based structure, allowing more than one parent node. It supports many-to-many data relationships.
Usage: This was the most widely used database model before the relational model was introduced.