Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 94265
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T23:28:28+00:00 2026-05-10T23:28:28+00:00

I have one table that saves comments for a varied set of content types.

  • 0

I have one table that saves comments for a varied set of content types. These are saved in other tables (news, articles, users). I wonder what’s the best way to connect these tables? In previous projects I used a second table for each kind of content. They held the id of the certain content mapped to ids of the comments table. So for each comment I had the comment entry itself and a ‘connector’ entry. An alternative would be to use a separate comments table for any kind of content. At the end both ways contain some redundancy flaw.

So which one should I use or is there the ONE solution?

  • 1 1 Answer
  • 3 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T23:28:28+00:00Added an answer on May 10, 2026 at 11:28 pm

    There are a few obvious ways to design your table:

    1) You can have a master Comments table, and intermediate tables to connect each comment to your Articles, News, and Users tables:

    Comments -------- ID  News      NewsComments ----      ------------ ID        NewsID           CommentID  Articles  ArticleComments --------  --------------- ID        ArticleID           CommentID  Users     UserComments -----     ------------ ID        UserID           CommentID

    Advantage of this is the relative ease of querying comments for each feature. However, this style suffers from referential integrity: its possible to connect a single comment to multiple comments, news articles, and users. Additionally, its not very scalable: if you add comments for RSS feeds, favorite links, user status, etc, then you have intermediate tables for all of those types.

    2) Another approach is a slightly denormalized version:

    Comments -------- ID TableName PkID (Connects the primary key in other tables)  News ---- ID    Articles -------- ID  Users ----- ID

    This works and it scales easily whenever you add new features, but you can’t key your Comments.RefID field to multiple tables simultaneously, so you lose referential integrity.

    3) The final option requires lots of redundant ‘comments’ tables for each feature.

    News      NewsComments ----      ------------ ID        NewsID  Articles  ArticleComments --------  --------------- ID        ArticleID  Users     UserComments -----     ------------ ID        UserID

    Advantage of this style is the preservation of referential integrity, and that its readily understanable to anyone looking at your schema. Disadvantage is the excessive number of tables with an identical schema.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was making one table that have two foreign key to another tables. But
I have a table that containts a set of columns one of it is
We have a script that saves some rows in a table and one of
I have one table that has sales records and another table that has additional
I have one table that has two fields - ID1 and ID2 ID1 can
Here is my situation: I have one table that contains a list of drugs
I have one table view that should be filtered by values of search field
Lets say I have one table called REVIEWS This table has Reviews that customers
I have one table, e.g. pricerules, that have stored special prices by article for
I have one datatable. In that table I have columns named [Total Day], [Present

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.