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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:40:04+00:00 2026-06-10T17:40:04+00:00

I got two tables (for now): Topic Post (post is a comment for a

  • 0

I got two tables (for now):

  1. Topic
  2. Post (post is a comment for a topic)

I want to add the option to Like those objects.
so I thought about creating one table of Likes and using enum to indicate which object was liked (including the object’s id of course).

by the way, if I choose this option, should it be an enum or another table represent all the objects:

id object_name
1 Topic
2 Post

another option is to create likes table for every object .

what is the best practice to take?

  • 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-06-10T17:40:06+00:00Added an answer on June 10, 2026 at 5:40 pm

    I think creating a separate table for each object is better.

    I don’t see what you gain if you use only one table. You can’t use foreign keys properly also in one table.

    I mean you can’t add a column object_id to your table, because you do not know the table to which it will point to. In this case you have two add two columns, topic_id and post_id. Always one of the two will be NULL.

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

Sidebar

Related Questions

I've got two tables: TableA Col1 Col2 TableB Col3 Col4 I want to join
I've two tables sermons(sermon_id,preacher_id,sermon_name etc) and preachers(preacher_id,firstname,lastname etc) . Now i display this like
I got two tables: comments and commentLikes in the same query i count the
I got two tables Product(Productname VARCHAR(10), Rating REAL) and Review(RatingID INT, Productname VARCHAR(10), Rating
I got two tables in my database: user and call. User exists of 3
I got two tables, one of which is a helper of the other. The
I've got two tables: TABLE A (columns: FirstValue, SecondValue, SeatNumber) currently empty TABLE B(1
I've got two tables, Products and ProductImages with a one to many relationship between
i've got two tables: members and members_data . They both share the same unique
I've got two tables. Invoice with columns CustomerID, InvoiceDate, Value, InvoiceTypeID (CustomerID and InvoiceDate

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.