Relational Model
A method for managing and logically representing the data kept in a database is the relational model for handling databases. The data is arranged in this model as a set of two-dimensional interconnected tables, or relations.
Every relation consists of a set of rows and columns, where the records are represented by the rows (or tuples) and the properties of an entity are represented by the columns. A simple, effective, and adaptable method of storing and retrieving structured data was made possible by the use of tables.

This data architecture makes data access and sorting simple due to its simplicity. As a result, it is widely utilized for processing and storing data worldwide.
Imagine that you would like to keep record of each student's name, CGPA, and roll number for a certain class. As explained below, this organized data can be easily saved in a table:
Roll no. | Name | CGPA |
---|---|---|
001 | Varun | 9.1 |
002 | Tannu | 9.5 |
003 | Annu | 8.5 |
004 | Harsh | 9.3 |
As we can see from the relation above, each row of the relation represents a student; in other words, the table's row represents a real-world thing.
The table's column display the attributes associated with the entity, the Student's Name, CGPA, Roll No.
Relational Model Concepts
A relational database is based on the relational model, as mentioned earlier. The relational model informs the structure of this database. These include:
1. Relation
A collection of data elements is stored in a two-dimensional table.
2. Tuple
Row of the relation, representing an actual object.
3. Attribute
The properties that define the relation are shown in the relation's column.
4. Attribute Domain
The legal values that an attribute can take are described by the set of pre-defined atomic values that it can accept.
5. Cardinality
It indicates the total number of rows in the relation or the number of entities involved in the relation.
6. Relational Schema
It is the relationship's logical blueprint, which means it outlines its structure and design. It includes the table's name, types, and characteristics.
7. Relational Instance
It is the group of documents that are part of the relationship at a certain point in time.
8. Relation Key
An attribute, or collection of attributes, can be used to identify an item in a table in a unique way or to understand how two tables relate to one another. Relation keys come in six varieties:
1. Primary Key
2. Candidate Key
3. Foreign Key
4. Alternate Key
5. Composite Key
6. Super Key
Types of Relational Models
1. One-to-One
2. One-to-Many
3. Many-to-Many
1. One-to-One
One row of data in one table is only related to one row of data in another table; these are known as one-to-one relationships. The relationship between a person and their passport is an actual example of a one-to-one relationship.
Since each person will only have one passport, there will be two tables: one for a list of people and another for a list of their passports.
2. One-to-Many
When one row of data in one table is connected to many (one or more) rows of data in another table, this is known as a one-to-many relationship. The class-student relationship is a real-world example of a one-to-many relationship.
One student will enroll in multiple classes at college. Therefore, a table that lists a group of classes will be coupled to another database that provides a list of students.
3. Many-to-Many
When multiple rows of data in one table are connected to multiple rows of data in another table, this is known as a many-to-many relationship.
A table containing a list of several university courses and a table containing a list of multiple student details is a real-world illustration of a many-to-many relationship. A student may enroll in more than one course, and a course may have a large number of attendant students.
Anomalies in the Relational Model
1. Insertion Anomalies
It is the inability to add information to the database because there isn't any other information there. As an example: Consider a scenario in which the GroupNumber attribute is specified to prohibit null values and the entire class is divided into groups for a project. The database cannot contain a new student who has been admitted to the class but has not yet been placed in a group.
2. Deletion Anomalies
When any other data element is deleted, it results in the unintentional loss of data in the database. Consider the following scenario: Let's say we have an employee relationship that includes the employee's information and the department they work for. Data related to the department will also be lost if we remove an employee's information from the table while they are employed by the department. Inconsistent data may result from this.
3. Modification Anomaliea
It is the data inconsistency that results from partial database updates and data redundancy. For instance, assume that duplicate entries were made when changing the data in the database. There will now be data inconsistencies in the database if the user is unaware that the data is saved redundantly following an update.