We are planning to capture a user’s height and weight and am looking for ideas on representing them in sql. I have the following questions in mind
-
weight can be expressed in kilograms and grams and height in meters and centimeters, so should I capture them as a BigDecimal with an appropriate precision and scale or capture them as vanilla strings and do the manipulation in the user interface. Note: I am planning to capture the kilograms and grams separately in the user interface.
-
should the metric of measurement be part of the sql (i.e. the end user might want to view this information in pounds, inches according to his preference)
OR
Should I just support kilograms / meters in the database and do the conversion while showing this in the user interface
For the first question, I would recommend you use integers and the smallest unit of record (centi-meters and grams for example). Only store one format in the database and do the conversion from within your application.