1

How would you create a database that sells products of the same cost for each size range.

Current Products Table:

  • Product 1 of 1mm
  • Product 1 of 2mm
  • Product 1 of 3mm
  • Etc up to 1000mm

Does it make sense to store it as mentioned above?

Or would you you store it as:

  • Product 1, minimum length 1mm, maximum length 1000mm

Each sale line will mention the exact size sold.

0

1 Answer 1

1

Typically one would do something like the second option you mentioned, with a dedicated dimension field for the Size and another field for the UnitOfMeasure (or UM for short). Or possibly refactoring those fields into a separate ProductDimensions table (though this is more optional / use case dependent).

This provides the most flexibility, and makes the most sense logically for the purpose of a Products table, as one would assume the table would store unique Products. Otherwise, seeing Product1 (etc) multiple times in the Products table could be confusing and / or complicate application logic.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.