Table column reference to different tables
Options
![Anna Sho](https://us.v-cdn.net/6037124/uploads/userpics/9J2BDR93V3FA/nAMOURF2V6E1B.jpeg)
Anna Sho
Member ✭
Hello!
I want users to like & comment records from diffrent tables (like products, posts & offfers etc)
What is the best DB design?
I think about this:
🔹c omments table has also columns:
product_id (if comment left for product)
offer_id (if left for offer post BUT then product_id is empty)
post_id
and for each comment record there should be reference in one of these3 columns.
OR? maybe we have 1 column with reference to diffrent tables? i dont see it possible.
Or please suggest how to do this correctly! 🙏
Thank you!
I want users to like & comment records from diffrent tables (like products, posts & offfers etc)
What is the best DB design?
I think about this:
🔹c omments table has also columns:
product_id (if comment left for product)
offer_id (if left for offer post BUT then product_id is empty)
post_id
and for each comment record there should be reference in one of these3 columns.
OR? maybe we have 1 column with reference to diffrent tables? i dont see it possible.
Or please suggest how to do this correctly! 🙏
Thank you!
Comments
-
I think that method is fine if you want one comments table.
You could also consider three separate comments table for each table they relate to.
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