Table Reference for multiple tables
![Felix Tan-2030210](https://us.v-cdn.net/6037124/uploads/userpics/ZV6H4XLKNXLQ/nFNYXIKPZYQ45.jpg)
When you have an integer, you're able to link it to another table as a table reference.
Technically speaking, it's just an integer, and if I want to, I can link it to multiple tables if I need to? Example below, with the following Tables:
- Posts
- Birthdays
- Comments
Both Posts and Birthdays can have comments, so under Table 3, Comments, I can have a "Parent" field, which could link to both Posts and Birthdays.
Within Xano, I just have it as an ordinary integer field, and not link it to any table, but in my queries and function stack, I can still use that integer as an ID to query both the Posts and Birthdays table should I need to.
What do you guys think? Or should I not structure my data in such a way?
Answers
-
You can absolutely do that - but you should keep in mind that this will not profit from joins or foreign key relationships at the database level. You'll need function stack code to know what kind of resource you are linking to. That's not the end of the world, but the price we pay for this flexibility is complexity and a performance hit.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback