Guide to Many-to-Many Relationships

Avatar

By Deepak Agarwal

updated about 1 month ago

Stackby is all about working on a single platform. That means it allows linking of related data/concepts together. To bring together your data, it is important you know how different types of relations work on Stackby.

In this article, we will discuss the different types of relationship that are possible for your data for its better management:

One-to-One

One-to-Many

Many-to-Many

Let's check out the types of relationships:


One-to-one

One-to-one is the simplest kind of data relationship -- most of us use it often in our day-to-day lives. For e.g. take the example of students' roll numbers in a classroom. Each student has one roll number and each roll number is allocated to one student. Both sets of data can be entered into a single table in two different fields. 


One-to-Many

As the name suggests, the one-to-many data is also self-explanatory as the one-to-one relationship data. Take the example of the hospitality industry -- a hotel may have many restaurants, but a restaurant can a part of only one of the hotels not all.

To create this type of data on Stackby, you need to use two tables -- one for the hotels and the other which will have all the restaurants. Now, link the two tables and bring the restaurants to the hotel and vice versa. When you do that the hotels may have different restaurants and each restaurant will be a part of just one hotel.


Many-to-Many

The final one -- Many-to-Many relationship. Let us take a typical example of FMCG products -- say soaps. Each customer/user may be using a variety of soaps and the soaps would be used or purchased by a variety of customers.

As with one-to-many relationships, creating a many-to-many relationship in Stackby is easy. All it takes is linking two tables.

Did this answer your question?