# One-to-Many vs. Many-to-One

## Learn About One-to-Many vs. Many-to-One Relationships

{% embed url="<https://youtu.be/fGvEHvibIoY>" %}

### **One-to-Many Relationship**

A one-to-many relationship exists when one record in the parent collection can be connected to multiple records in the child collection, but each child record can only connect to one parent.

**Example: Users and Workouts**

* One user can have ***many*** workouts
* Each workout belongs to only ***one*** user

In the Workouts collection, you'd add a Relationship property called "User" that points to a specific user. This is the simplest relationship type to set up and typically doesn't require junction collections.

### **Many-to-One Relationship**

A many-to-one relationship exists when multiple records in one collection can connect to a single record in another collection.

**Example: Orders and Customers**

* ***Many*** orders belong to one customer
* Each order is connected to only ***one*** customer

In the Orders collection, you'd add a Relationship property called "Customer" that points to a specific customer. This is the same relationship structure as the Users and Workouts example, just described from the opposite perspective.

**The key difference in perspective:**

* **One-to-Many (Users → Workouts):** "One user has many workouts" (viewing from the parent)
* **Many-to-One (Orders → Customer):** "Many orders belong to one customer" (viewing from the child)

{% hint style="danger" %}

* **Relationships can not be set or updated from the parent side of record in the Adalo database.**
* **Relationships can not be set upon Create Action of a parent record.**
  {% endhint %}

They're the same relationship type. The distinction comec from which collection you're looking at when you set up the Relationship. In Adalo, you'd set them up identically by adding a single relationship property to the child collection (Workouts or Orders) that points to the parent collection (Users or Customers).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.adalo.com/database/relationships/one-to-many-vs.-many-to-one.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
