Suppose you want to write into a database that something is 30 meters long, or 50 feet, or the temperature was 50 kelvin, the speed was 50 kilometers per hour.
How would you represent the units ?
To clarify, two points:
- any kind of units, not a predefined, well defined subset of them.
- my question is more relative to the existence of an ontology of units. I took the database example because it was the first that crossed my mind, but scenarios like representing the unit in XML or JSON are equally likely.
One of the fundamental concepts of relational database design is that all values in a given column should represent some logically compatible type of data. Formally, a column has exactly one single type, and any two values in a type can be compared to each other in an equality predicate. This is a crucial part of type theory.
So if the measurements are not comparable, i.e. length vs. temperature, you shouldn’t store them in the same column.
You might want to look at ISO 2955, “Information processing – Representation
of SI and other units in Systems with limited Character sets.”
Also see “Joe Celko’s SQL Programming Style,” chapter 4, Scales and Measurements.