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 6862875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:42:50+00:00 2026-05-27T02:42:50+00:00

In the project I’m developing I’ve got several common objects that span and associate

  • 0

In the project I’m developing I’ve got several “common objects” that span and associate several other tables.

Think, for example, at the object “Comment”. It should be applicable to many kind of different objects: a photo, an action, an event… and it always haves the same structure (author, text, insertion_time, …)

The first solution I adopted was to have separate tables for each kind of comment: PhotoComments, EventComments and relate those to pertinent objects with a one-to-many relationship with (for example) a photo_id column.

The second (and current one) consist in having a single Comments table (each with its own id) and have as many as needed “many-to-one” support tables to relate those comments with (ie) their photo.

Are there any downsides in having such a design?

  • 1 1 Answer
  • 0 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. Editorial Team
    Editorial Team
    2026-05-27T02:42:51+00:00Added an answer on May 27, 2026 at 2:42 am

    If you load the data a comment belongs to, and then look for comments assigned to it, then a single comments, with a one to many works well.

    If however you want to find the entity a comment belongs to then one to many tables becomes painful, as you have to look through all the link tables to find what a comment belong to. Of course you could add another column to your comments table to indicate what entity type it belongs to and then you know which link table to go to. From the sounds of things your comments don’t belong to multiple entities, which removes that complication.

    I’d go with the single comments table (and probably move author to a table of its own, so you can easily see which comments belong to one author, without duplicating the author information in each record)

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

Sidebar

Related Questions

A project I'm working on at the moment involves refactoring a C# Com Object
My project is currently using a svn repository which gains several hundred new revisions
Project Euler has a paging file problem (though it's disguised in other words). I
Project Requirements: I need to build a web service that will receive chunks of
Project is C#. So I have a bunch of multithreaded code that is designed
Project Structure I have a silverlight project SLProj, that references a silverlight class library
My project has a reporting module that gathers data from the database in the
project type is MVC2. Let say that i have page1. after success it write
Project: I am having a button that toggles the column length from 3 to
My project works troubleless in internet explorer but in firefox or other browsers it

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.