# How can i make relation between two tables?

I want to give relation key between two tables like foreign key but i couldn't. Please help me with that.

##### Post Metadata
- Posted at: over 6 years ago
- Author title: Team Lead at Infibeam
- Net upvotes: 2


## Comments
### Comment 1

Here there is no problem with data duplication, you can use a common id in both tables and query each one with the common information or simply put the information you require from the other table in a single table.

##### Comment Metadata
- Posted at: over 4 years ago
- Author title: Software developer



### Comment 2

You can simple add relations by adding reference to that documents 
example code in JavaScript: 

const sendContactUs = async (userData, uid) =&gt; {
    await firestore().collection(&quot;ContactUs&quot;).add({
        Email: userData.Email,
        phoneNumber: userData.phoneNumber,
        message: userData.message,
        uid: uid,
        user: firestore().collection(&quot;Users&quot;).doc(uid),
        status:&quot;Pending&quot;
    })
}


##### Comment Metadata
- Posted at: over 4 years ago
- Author title: React JS || React Native || Node JS  || Blockchain || MongoDB || MSSQL



### Comment 3

Firebase in not relational database. Its a NoSQL DB like MongoDB. So theoretically you can&#39;t make relation between tables. What you can do is keep id reference of one table (or better say json file/data) into other and query accordingly or filter it locally on client side with high level functions like reduce and/or filter.

##### Comment Metadata
- Posted at: over 6 years ago
- Author title: Senior iOS Engineer at NovaSignal




## Related Product
[Firebase](https://www.g2.com/products/firebase/reviews)

## Related Category
[Mobile Development Platforms](https://www.g2.com/categories/mobile-development-platforms)

## Related discussions
- [How well does Trello scale into a larger team?](https://www.g2.com/discussions/1-how-well-does-trello-scale-into-a-larger-team)
  - Posted at: almost 13 years ago
  - Comments: 6
- [Can we please add a new section](https://www.g2.com/discussions/2-can-we-please-add-a-new-section)
  - Posted at: almost 13 years ago
  - Comments: 0
- [Quantifiable benefits from implementing your CRM](https://www.g2.com/discussions/quantifiable-benefits-from-implementing-your-crm)
  - Posted at: almost 13 years ago
  - Comments: 4


