# How do I establish relations between existing tables

**URL:** <https://community.nocodb.com/t/how-do-i-establish-relations-between-existing-tables/923>\
**Category:** Grid-View\
**Created:** [October 31, 2023, 2:38pm UTC](https://community.nocodb.com/t/how-do-i-establish-relations-between-existing-tables/923 "2023-10-31T14:38:05Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bordspelwereld](https://yyz1.discourse-cdn.com/flex011/user_avatar/community.nocodb.com/bordspelwereld/32/406_2.png) [@Bordspelwereld](https://community.nocodb.com/u/Bordspelwereld)\
**Post date:** [October 31, 2023, 2:38pm UTC](https://community.nocodb.com/t/how-do-i-establish-relations-between-existing-tables/923/1 "2023-10-31T14:38:05Z")

</div>

Good afternoon

After 35 years of marriage with Filemaker we filed for divorce and i found myself a new friend.

She is a bit unwilling  
She doesn’t seem to understand the most simple things I want

Making a relationship between two fields, which in my old marriage was a case of drag and drop.  
I see explained how to make a link from a NEW field, but how to do this from existing tables and fields?

---

<div class="post-metadata">

**Author:** ![Navi](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@Navi](https://community.nocodb.com/u/Navi)\
**Post date:** [October 31, 2023, 3:05pm UTC](https://community.nocodb.com/t/how-do-i-establish-relations-between-existing-tables/923/2 "2023-10-31T15:05:56Z")

</div>

😆

If the relation already exists between tables on that database - we automatically identify the relation. If not I’ve created [an issue](https://github.com/nocodb/nocodb/issues/6848) to make things happens between us 😆

PS : we did discuss this problem just yesterday internally.

---

<div class="post-metadata">

**Author:** ![Bordspelwereld](https://yyz1.discourse-cdn.com/flex011/user_avatar/community.nocodb.com/bordspelwereld/32/406_2.png) [@Bordspelwereld](https://community.nocodb.com/u/Bordspelwereld)\
**Post date:** [October 31, 2023, 3:36pm UTC](https://community.nocodb.com/t/how-do-i-establish-relations-between-existing-tables/923/3 "2023-10-31T15:36:04Z")

</div>

I don’t know what you are trying to tell me here.  
Who is “we” and who are “us”???  
And what you mean with these emoticons?

So let me explain my problem

I Have started today with NocoDB after working with Filemaker since 1986

I have started with importing four tables from a very simple DB in an attempt to try to understand the workflow of NocoDB.

HOW do I set relations between fields in two tables if these tables and fields already exist?  
Is this possible?

---

<div class="post-metadata">

**Author:** ![Navi](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@Navi](https://community.nocodb.com/u/Navi)\
**Post date:** [October 31, 2023, 3:42pm UTC](https://community.nocodb.com/t/how-do-i-establish-relations-between-existing-tables/923/4 "2023-10-31T15:42:23Z")

</div>

Does the relationship between these table already exists ?

How does your table look like - giving two options below

1. country (id, title) and city (id, title, country\_id)
2. country (id, title) and city (id, title)

If its like option 2. You go to country table and create a new column of type ‘links’ and choose has-many as the relationship type. It will automatically create the country\_id in the city table.

If its option 1 : then the newly created issue that I pointed needs to be implemented within NocoDB.

Happy to clarify - pls provide an example.

---

<div class="post-metadata">

**Author:** ![Bordspelwereld](https://yyz1.discourse-cdn.com/flex011/user_avatar/community.nocodb.com/bordspelwereld/32/406_2.png) [@Bordspelwereld](https://community.nocodb.com/u/Bordspelwereld)\
**Post date:** [October 31, 2023, 3:45pm UTC](https://community.nocodb.com/t/how-do-i-establish-relations-between-existing-tables/923/5 "2023-10-31T15:45:39Z")

</div>

There are four tables in the DB.  
There is no relation yet. But the tables are already filled with data  
I am trying to make a “one to many” relation between 2 existing fields in existing tables

---

<div class="post-metadata">

**Author:** ![Navi](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@Navi](https://community.nocodb.com/u/Navi)\
**Post date:** [October 31, 2023, 3:47pm UTC](https://community.nocodb.com/t/how-do-i-establish-relations-between-existing-tables/923/6 "2023-10-31T15:47:26Z")

</div>

Sorry then - as mentioned above its currently not possible. As a work around - you can create the foreign key relationship between those four tables on the actual database. And do a [metadata sync](https://docs.nocodb.com/data-sources/sync-with-data-source/) - that should work.

---

<div class="post-metadata">

**Author:** ![Bordspelwereld](https://yyz1.discourse-cdn.com/flex011/user_avatar/community.nocodb.com/bordspelwereld/32/406_2.png) [@Bordspelwereld](https://community.nocodb.com/u/Bordspelwereld)\
**Post date:** [October 31, 2023, 3:52pm UTC](https://community.nocodb.com/t/how-do-i-establish-relations-between-existing-tables/923/7 "2023-10-31T15:52:01Z")

</div>

hmmmm… bummer.

So… if you’ve got data already in a field you can not make a relationship?

---

<div class="post-metadata">

**Author:** ![Bordspelwereld](https://yyz1.discourse-cdn.com/flex011/user_avatar/community.nocodb.com/bordspelwereld/32/406_2.png) [@Bordspelwereld](https://community.nocodb.com/u/Bordspelwereld)\
**Post date:** [October 31, 2023, 3:55pm UTC](https://community.nocodb.com/t/how-do-i-establish-relations-between-existing-tables/923/8 "2023-10-31T15:55:34Z")

</div>

Another question.  
What I did today was: import data and let NocoDB make the tables.  
What if I do it the other way around?

Create the table (with the linked fields and THEN import data?

---

<div class="post-metadata">

**Author:** ![Navi](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@Navi](https://community.nocodb.com/u/Navi)\
**Post date:** [October 31, 2023, 3:56pm UTC](https://community.nocodb.com/t/how-do-i-establish-relations-between-existing-tables/923/9 "2023-10-31T15:56:58Z")

</div>

Yes, the proposed way of bringing in the data after linking should work.

---

<div class="post-metadata">

**Author:** ![Bordspelwereld](https://yyz1.discourse-cdn.com/flex011/user_avatar/community.nocodb.com/bordspelwereld/32/406_2.png) [@Bordspelwereld](https://community.nocodb.com/u/Bordspelwereld)\
**Post date:** [October 31, 2023, 5:01pm UTC](https://community.nocodb.com/t/how-do-i-establish-relations-between-existing-tables/923/10 "2023-10-31T17:01:32Z")

</div>

Okay, if this is the proposed way…  
Please explain how.

I can only import into the project, which creates a new table.  
How do I import into an existing table?

---

<div class="post-metadata">

**Author:** ![Navi](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@Navi](https://community.nocodb.com/u/Navi)\
**Post date:** [November 1, 2023, 12:50pm UTC](https://community.nocodb.com/t/how-do-i-establish-relations-between-existing-tables/923/11 "2023-11-01T12:50:22Z")

</div>

You can see here on how to [import data into existing table](https://docs.nocodb.com/tables/import-data-into-existing-table/).

---

<div class="post-metadata">

**Author:** ![Bordspelwereld](https://yyz1.discourse-cdn.com/flex011/user_avatar/community.nocodb.com/bordspelwereld/32/406_2.png) [@Bordspelwereld](https://community.nocodb.com/u/Bordspelwereld)\
**Post date:** [November 1, 2023, 1:17pm UTC](https://community.nocodb.com/t/how-do-i-establish-relations-between-existing-tables/923/12 "2023-11-01T13:17:04Z")

</div>

Oh, I see!  
Thank you so far!

---

<div class="post-metadata">

**Author:** ![joeldebruijn](https://avatars.discourse-cdn.com/v4/letter/j/f07891/32.png) [@joeldebruijn](https://community.nocodb.com/u/joeldebruijn)\
**Post date:** [December 30, 2024, 7:34am UTC](https://community.nocodb.com/t/how-do-i-establish-relations-between-existing-tables/923/13 "2024-12-30T07:34:18Z")

</div>

Is this the same question is this one:  
[Update relationships from CSV or Excel [May 15]](https://community.nocodb.com/t/update-relationships-from-csv-or-excel-may-15/453) ?

How do I interpret the status of this issue:

> <https://github.com/nocodb/nocodb/issues/6848>
>
> \### Please confirm if feature request does NOT exists already ?
> 
> \- \[X\] I confirm… there is no existing issue for this
> 
> \### Describe the usecase for the feature
> 
> \- Currently either we create new Links or automatically identify if the relation already exists.
> \- However we need a way to link two tables given and the user should be able to choose those columns. 
> 
> \### Suggested Solution
> 
> .
> 
> \### Additional Context
> 
> \_No response\_

I dont know Github well enough but I guess its on the issue board?  
But having a hard time understanding if its on hold or open or just gone, I cant find it on the issue board anymore?

Background: I have 10 years of data in a closed source Android app (Sailforms) with around 70 tables exported to csv, but some tables function as ‘pick-list’ or ‘filter’ values for other tables. My intention is to import the tables and then establish relationships between them one-by-one.

---

<div class="post-metadata">

**Author:** ![dstala](https://avatars.discourse-cdn.com/v4/letter/d/f04885/32.png) [@dstala](https://community.nocodb.com/u/dstala)\
**Post date:** [December 31, 2024, 4:24am UTC](https://community.nocodb.com/t/how-do-i-establish-relations-between-existing-tables/923/14 "2024-12-31T04:24:49Z")

</div>

The feature request in github that you are referring to - has not been picked up yet unfortunately, but it is in our roadmap for next quarter.

For now, you will have to rely on building a script using our APIs to make this happen  
[https://data-apis-v2.nocodb.com/#tag/Table-Records/operation/db-data-table-row-nested-link](https://data-apis-v2.nocodb.com/#tag/Table-Records/operation/db-data-table-row-nested-link)

---

<div class="post-metadata">

**Author:** ![joeldebruijn](https://avatars.discourse-cdn.com/v4/letter/j/f07891/32.png) [@joeldebruijn](https://community.nocodb.com/u/joeldebruijn)\
**Post date:** [December 31, 2024, 7:34am UTC](https://community.nocodb.com/t/how-do-i-establish-relations-between-existing-tables/923/15 "2024-12-31T07:34:11Z")

</div>

Ah thnx, I will be patient then, Nocodb has much to offer compared to a local Android app and for long term I want something more open also.

---

<div class="post-metadata">

**Author:** ![ideajulio](https://avatars.discourse-cdn.com/v4/letter/i/7993a0/32.png) [@ideajulio](https://community.nocodb.com/u/ideajulio)\
**Post date:** [January 11, 2025, 2:27pm UTC](https://community.nocodb.com/t/how-do-i-establish-relations-between-existing-tables/923/16 "2025-01-11T14:27:34Z")

</div>

How did you solve it?

---

<div class="post-metadata">

**Author:** ![Navi](https://avatars.discourse-cdn.com/v4/letter/n/3be4f8/32.png) [@Navi](https://community.nocodb.com/u/Navi)\
**Post date:** [January 11, 2025, 2:45pm UTC](https://community.nocodb.com/t/how-do-i-establish-relations-between-existing-tables/923/18 "2025-01-11T14:45:09Z")

</div>

You will have to create relation within your database and then do a [meta sync/](https://docs.nocodb.com/data-sources/data-source-overview/#overview).
