When redesigning an application that uses Metric & English units for data, how to store data in datatabase

datadatabase-designdevelopment-processrefactoring

In my application users compute some engineering data (physical quantities like lengths, and weights).

Currently the core formulas work on and assume English system, but user can select English or Metric system to work in. If English is selected, no special provisions are required, everything is done in English.

But if user selects Metric, there are two conversions that take place — one on input and on on output, to keep things consistent. Currently the existing application I work with, stores data in both units.

My question is about which values do I store in the database — the ones that are using English units or the converted ones that are using Metric?

More so, is this a type of question where the answer is "toss a coin", or are there some definitive benefits of one over the other?

More Detail on what can happen when user chooses to use Metric

After initial conversions the computation engine crunches the English unit system numbers, and is ready to save them in the database, here are my two choices:

Way 1 – Storing Metric Data in database (also storing English Data as well)

  1. Convert to data to Metric system, when needed, and store it in the database (making note that data is in Metric units). With English data, store it as is in the database and mark it as English
  2. When viewing data, no conversion required

Way 2 – Storing English Data in database (and only English)

  1. Do NOT convert, store data using English system (but making note that data is in English units)
  2. When viewing data, convert to Metric for display, when user-requested.

Best Answer

Another possibility:

Store the unit of measurement preference on a user table as opposed to the measurement value table.

Store all measure data in a consistent form (Either English or Metric). Do the conversion as needed based on user preference.

Also, if one needed to export the data it would be easier to work with if all values in a consistent format.

Related Topic