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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:54:14+00:00 2026-05-27T06:54:14+00:00

I have products in my database (MySQL). I have my prices based on different

  • 0

I have products in my database (MySQL).
I have my prices based on different combinations of options for my products.
I have the following data:

PRODUCTS

prodID | prodName
1      | Ball

OPTIONS

optionID | optionName | prodID
1        | color      | 1
2        | size       | 1
3        | material   | 1

OPTIONVALUES

ovID | optionID | ovValue
1    | 1        | red
2    | 1        | blue
3    | 2        | small
4    | 2        | big
5    | 3        | wood
6    | 3        | glass

for prices I would like to have like this:

red small wood ball – $13
red small glass ball – 14
red big wood ball – 16
red big glass ball – 17
blue small wood ball – 12.5
[…]

How can I design the database structure for this?
I have tried several ways but none was good. if the number of the options were static then every option could have its own table, but this was that is not a good solution.

  • 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-27T06:54:14+00:00Added an answer on May 27, 2026 at 6:54 am

    I like what you already have. If you want it to be fully flexible as i guess you do, i would do the following:

    Add two more Tables.

    Product_Instance

    instanceID | prodID | price
    1          | 1      | 13
    

    Product_Instance_Options

    instanceID | ovID
    1          | 1
    1          | 3
    1          | 6
    

    In this way you could define all possible combinations and prices for them. Might be a hell of a lot work to set up all the prices, but if you cant calculate them (like glass = +2$, small=2$ / big=4$) you will have this however you do it.

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

Sidebar

Related Questions

I have a site that displays data on travel products from a MySQL database.
I'm using a MySQL database. I have a products database where users can search
I have a MySQL database with a fairly large table where the products are.
I have the following (simplified) database tables: Products - ProductID, int, PK - Name,
We have a mySQL database table for products . We are utilizing a cache
In setting up a MySQL database, consider that I have a table of products
I am using Mysql database. I have 3 table-: table Column tier_price customer_id,sku(Unique),price,website catalog_product
I have a table called Products in my database. It has a couple of
I have a page with a list of lot of Products from the database.
I have a database with 150 million products, I would like index these using

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.