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

  • SEARCH
  • Home
  • 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 9187959
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:53:59+00:00 2026-06-17T19:53:59+00:00

I want to store comparisons between items in a mysql table. For example, I

  • 0

I want to store comparisons between items in a mysql table. For example, I have the following three items:

  • id: 1, Name: Item A, comparisionScore: 1
  • id: 2, Name: Item B, comparisionScore: 2
  • id: 3, Name: Item C, comparisionScore: 3

Which means while comparing, the item whose comparisonScore is larger is better. However this method fails when I want to insert a new item to the table, which is better than Item A and worse than Item B, let’s say Item D. So I can do the following because I don’t have to store only integers:

  • id: 1, Name: Item A, comparisionScore: 1
  • id: 2, Name: Item B, comparisionScore: 2
  • id: 3, Name: Item C, comparisionScore: 3
  • id: 4, Name: Item D, comparisionScore: 1.5

The worst thing is that since we can’t know the number of new items to be added, there is not enough number for this purpose. For example, by dividing the range by 2, the result can be the following:

  • id: 1, Name: Item A, comparisionScore: 1
  • id: 2, Name: Item B, comparisionScore: 2
  • id: 3, Name: Item C, comparisionScore: 3
  • id: 4, Name: Item D, comparisionScore: 1.5
  • id: 5, Name: Item E, comparisionScore: 1.75
  • id: 6, Name: Item F, comparisionScore: 1.875
  • id: 7, Name: Item G, comparisionScore: 1.9375
  • id: 8, Name: Item H, comparisionScore: 1.96875 …

If the Item Z is better than the Item A and worse than the Item H, there is no double value that can Z take between 1.9999… and 2.

So the thing is what else method can I use to store comparison data between Items in MySQL data?

I should be able to answer when a user asks which one is better Item A or Item D by looking that table.

  • 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-17T19:54:01+00:00Added an answer on June 17, 2026 at 7:54 pm

    Instead of starting out with comparison scores of 1, 2, 3; give much larger integer values like 10,000, 20,000, 30,000. Then you have some room to insert values in the middle.

    To answer your last question, when you’re trying to insert a comparison score between 12,384 and 12,385, you have to renumber all of the comparison scores first, so that you have a spot to put the newest comparison score.

    The numbers are only meaningful for sorting, so you can change them anytime you wish.

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

Sidebar

Related Questions

I have a MySQL SELECT query which uses 20 different comparisons within the same
I want to store user-clicked data in a cookie which never has to go
I want to store the TF-IDF matrix so I don't have to recalculate it
Say want to store the following: typedef std::function<void(int)> MyFunctionDecl; ..in a collection: typedef std::vector<MyFunctionDecl>
I want a thorough list regarding comparison between the two. Things I have known:
I have a table in which date column is stores as varchar. while doing
We have a passwords table which references a user table. Records never get deleted
I have a class for which I have defined comparison operator. Following is the
I have a grid backed by a grouping store in which I have a
I'm using PHP and MySQL , and I want to store users' IP addresses

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.