mirror of https://github.com/nocodb/nocodb
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
3.1 KiB
77 lines
3.1 KiB
3 years ago
|
---
|
||
3 years ago
|
title: "Link To Another Record"
|
||
3 years ago
|
description: "Understanding Link To Another Record (LTAR) Columns!"
|
||
3 years ago
|
---
|
||
|
|
||
3 years ago
|
### Relationship types:
|
||
3 years ago
|
|
||
3 years ago
|
- One to one
|
||
3 years ago
|
- A Table record in first table is related to only one record of second table.
|
||
3 years ago
|
- Example: Country has a capital city
|
||
3 years ago
|
- One to many
|
||
3 years ago
|
- A Table record in first table is related to more than one record of second table. But second table record maps to only one entry of first table
|
||
|
- NocoDB refers to this category of relationship as **has many**
|
||
|
- For every **has many** relation defined, NocoDB augments **belongs to** relationship column in the other table automatically
|
||
|
- Example: Country **has many** Cities. (other way mapping > City **belongs to** Country )
|
||
|
- Many to many
|
||
|
- A Table record in first table is related to more than one record of second table; second table record can also map to more than on record of first table.
|
||
|
- NocoDB refers to this category of relationship as **many to many**
|
||
|
- For every **many to many** relation defined between tables, NocoDB augments **many to many** relationship column in the other table automatically
|
||
3 years ago
|
- Example: Film **has many** Actors. Actor **has many** Films (works on many films)
|
||
3 years ago
|
|
||
|
Further details of relationship types can be found [here](https://afteracademy.com/blog/what-are-the-different-types-of-relationships-in-dbms)
|
||
|
|
||
|
Relationships between table records can be established by using **LinkToAnotherRecord** column type.
|
||
|
Workflow details are captured below
|
||
|
|
||
|
## Adding a relationship
|
||
3 years ago
|
|
||
1 year ago
|
<img width="1016" alt="image" src="https://user-images.githubusercontent.com/35857179/189105583-20014dd9-e5a6-4f27-b03c-97fad9096b5f.png" />
|
||
3 years ago
|
|
||
3 years ago
|
### 1. Create column
|
||
|
|
||
3 years ago
|
Click on '+' button at end of column headers
|
||
3 years ago
|
|
||
|
### 2. Update column name
|
||
|
|
||
3 years ago
|
Input name in the text box provided
|
||
3 years ago
|
|
||
|
### 3. Select column type
|
||
|
|
||
3 years ago
|
Select Column type as "LinkToAnotherRecord" from the drop-down menu
|
||
3 years ago
|
|
||
|
### 4. Choose relationship type
|
||
|
|
||
2 years ago
|
- 'Has Many' corresponds to the 'One-to-many' relationships
|
||
|
- 'Many To Many' corresponds to the 'Many-to-many' relationships
|
||
3 years ago
|
|
||
|
### 5. Select child table from drop down menu
|
||
|
|
||
|
### 6. Click on 'Save'
|
||
|
|
||
3 years ago
|
A new column will get created in both the parent table & child table
|
||
|
|
||
3 years ago
|
## Updating linked records
|
||
3 years ago
|
|
||
3 years ago
|
### 1. Open link record tab
|
||
3 years ago
|
|
||
|
Click on the '+' icon in corresponding row - cell
|
||
1 year ago
|
<img width="750" alt="image" src="https://user-images.githubusercontent.com/35857179/189106326-90e46156-798d-4a01-a4eb-4e991ce94c03.png" />
|
||
3 years ago
|
|
||
3 years ago
|
### 2. Select from the option displayed
|
||
|
|
||
3 years ago
|
Use 'Filter box' to narrow down on search items
|
||
|
You can opt to insert a new record as well, using "+ New Record" button
|
||
1 year ago
|
<img width="1014" alt="image" src="https://user-images.githubusercontent.com/35857179/189106494-4b49a200-a44f-41ae-8b54-93b18d867a04.png" />
|
||
3 years ago
|
|
||
3 years ago
|
### 3. Column mapping showing "Has Many" relationship
|
||
|
|
||
2 years ago
|
Sheet1 'has many' Sheet2
|
||
|
|
||
1 year ago
|
<img width="756" alt="image" src="https://user-images.githubusercontent.com/35857179/189106702-3b8d7a50-08f4-4a04-b2cb-16db0cf667b3.png" />
|
||
3 years ago
|
|
||
3 years ago
|
### 4. Column mapping for "Belongs to" relationship [Automatically updated]
|
||
3 years ago
|
|
||
2 years ago
|
Sheet2 'belongs to' Sheet1
|
||
|
|
||
1 year ago
|
<img width="574" alt="image" src="https://user-images.githubusercontent.com/35857179/189106731-59e5bc3c-bcc5-4796-b5b2-d9b5418bfe2b.png" />
|