# Relationships

A relationship lets you link one record to another (or many others). \
The examples above showed how you can relate Projects to Companies, and Projects to Owners, but there are 4 different types of relationships all together. <br>

### **One to One**

This is when each side of the relationship can only be directly related to at most one other record. \
For example, if each **Company** needed to be assigned an **admin,** you could say that each Company can have exactly one admin, but an admin can only be the admin of at most one company. \
That way you can easily access the company's admin's details. <br>

### **Many to One**

This is the most common relationship. The relationships used in our examples were examples of many to one relationships. \
That is to say, A given many projects can have the same company, but a project can only have one company. \
\
If you are using this data in the builder, the company will have a list of projects associated with it, but the project will have only one company associated with it. <br>

### **One to Many**

This behaves the same as many to one but in reverse. It's handy if you can't figure out exactly which side of the relationship to put the field on. Although it's always preferable to use a Many to One. \
\
For example, instead of adding the Many to one relationship on the **Project** table, you could instead add a One to Many relationship on the **Company** table, the end result would be the same. <br>

### **Many to Many**

This is the most complex of all the relationships, but it is very useful if you need to have multiple options on both sides of the relationship. \
\
If we take our Project owner relationship, but instead of a project only having one owner, if we change it to allow it to have **multiple** owners, then we would need a many to many relationship. \
\
Each project can have many owners, and an owner (user) can be the owner to many projects.\
\
When using this data in your portal, each side of the relationship will have a list of the opposite type. I.e. users will have a list of owned projects and projects will have a list of owners.


---

# 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://guides.noloco.io/~/revisions/4ycMT0EcUe4aYSGLpT5Z/data/collections/relationships.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.
