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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T20:48:13+00:00 2026-05-17T20:48:13+00:00

I’m trying to understand if it’s right to use one table for votes for

  • 0

I’m trying to understand if it’s right to use one table for votes for more than one argument:

table_votes
id | vote (±1) | id_user | timestamp | argument_type | argument_id


table_photos // could be argument_type = 1
id | photo_file | photo_name | etc.    


table_house // could be argument_type = 2
id | house_name | etc.

My problem starts if I’d like to use it to rename e table value, for example house names, I could create a table to change suggestions based on users agreement, for example 3 votes on 5 total.

table_house_name_suggestion // could be argument_type = 3
id | new_house_name | old_house_name | id_user | timestamp | locked // when votes are enough

So, could this be a right way or I’m losing something important which guide me to use a vote table for every argument or should I think to create a vote table for every argument?

  • 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-17T20:48:14+00:00Added an answer on May 17, 2026 at 8:48 pm

    Create a table that knows about all arguments (PK and FK denote primary and foreign keys):

    vote  { vote_id PK, vote, user_id, timestamp, arg_id FK(arg.arg_id) }
    arg   { arg_id PK }
    photo { photo_id PK FK(arg.arg_id), photo_file, photo_name, ... }
    house { house_id PK FK(arg.arg_id), house_name, ... }
    

    Note that photo_id and house_id are actually arg_ids. The only potential inconsistency is that a single arg could be both a photo and a house, so the business layer would have to ensure that that can never happen.

    Now, I’m a little confused about the second half of the question. The argument_type refers to whether it’s a photo or a house, right? If so, argument_type = 3 suggests that house_name_suggestion is just another type of thing you can vote on. It is of course, closely related to the house table, but from the perspective of voting, I’d say that this is irrelevant. If so, then you simply add a new table to the mix:

    house_name_suggestion { house_name_suggestion_id PK FK(arg.arg_id),
                            house_id FK(arg.arg_id), new_house_name, old_house_name, ... }
    

    Note, however, that I’ve added a house_id column. While I’m not 100% sure, I think you were using the id column to double up as a primary key and as a reference to the house table, which would have meant that each house could only have one house-name suggestion.

    Side note: You have a mixture of plural and singular nouns in your table names. I strongly suggest sticking to singular. Also, the table_ prefix adds very little value, and is a pain to work with. Don’t bother with it.

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

Sidebar

Related Questions

I am trying to understand how to use SyndicationItem to display feed which is
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
I am trying to loop through a bunch of documents I have to put
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm making a simple page using Google Maps API 3. My first. One marker
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
Seemingly simple, but I cannot find anything relevant on the web. What is the

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.