What is the Difference Between Relation and Relationship in DBMS

The main difference between relation and relationship in DBMS is that relation refers to a table in a relational model based database while relationship refers to how two tables are connected together in a relational model based database.

A database is a collection of related data. A DBMS or Database Management Software allows creating, defining, and manipulating data in the database easily. It is easier to store, process and analyze data easily using a DBMS.  It allows multiple users to access data and also provides protection and security to the databases. There are various database models. In the relation model, data is stored in tables and these tables are related to each other. A relation is a table or an entity while the relationship is the association between two tables.

Key Areas Covered

1. What is Relation in DBMS
     – Definition, Functionality
2. What is Relationship in DBMS
     – Definition, Functionality
3. What is the Difference Between Relation and Relationship in DBMS
     – Comparison of Key Differences

Key Terms

DBMS, Relation, Relationship

Difference Between Relation and Relationship in DBMS - Comparison Summary

What is Relation in DBMS

A database consists of a set of tables. A table is also called an entity. It is a basic structure of data in the relational model. A table consists of rows and columns. A row or tuple represents a single entry in the table. The columns represent the attributes.

Difference Between Relation and Relationship in DBMS

Figure 1: Relation

For example, University database can have tables such as Student, Lecturer, and Course. The Student table can have attributes such as id, name, address, telephone_no, etc. The Lecturer table can have attributes such as id, name, address, specialization, and, department. These two tables, i.e., Student and Lecturer tables, are relations.

What is Relationship in DBMS

Relationship describes how two tables or entities are connected to each other. These tables can be associated with each other using constraints such as primary keys, and foreign keys. A primary key is the main key of a table. It helps to uniquely identify each record in a table. When the primary key in one table is added to some other table, that primary key becomes a foreign key in the new table.

Main Difference - Relation vs Relationship in DBMS

Figure 2: Relationships among Tables

For example, assume that an organization has a sales database. This database has two tables called customer and product.  The customer table has attributes such as customer_id, name, address, phone_no, etc. The primary key of the customer table is the customer_id. The product table has attributes such as product_id, name, quantity, and, sold_date. The primary key of product table is product_id. Adding the product id to the customer table will connect these two entities. The product_id is a primary key in Product table but it becomes a foreign key in the Customer table. Likewise, the entities can be connected to each other. These linking or connection in DBMS is known as a relationship.

Difference Between Relation and Relationship in DBMS

Definition

Relation is a table or an entity in a relational model based database that consists of different attributes. Relationship is an association among two entities in a relational model based database. This is the basic difference between relation and relationship in DBMS.

Basics

Another difference between relation and relationship in DBMS is that the relation is an entity while the relationship is the connection between two entities.

Conclusion

The difference between relation and relationship in DBMS is that relation refers to a table in a relational model based database while relationship refers to how two tables are connected together in a relational model based database.

Reference:

1. “DBMS Database Models.” Types of Network Topology in Computer Networks | Studytonight, Available here.
2. “Basic Relational DBMS Concepts.” Types of Network Topology in Computer Networks | Studytonight, Available here.

Image Courtesy:

1. “Rel model” By Tsedenjav.Sh – Own work (CC BY-SA 4.0) via Commons Wikimedia
2. “1895779” (CC0) via Pixabay

About the Author: Lithmee

Lithmee holds a Bachelor of Science degree in Computer Systems Engineering and is reading for her Master’s degree in Computer Science. She is passionate about sharing her knowldge in the areas of programming, data science, and computer systems.

Leave a Reply