My database stores version numbers; however, they are presented in two formats: major.minor.build (for example, 8.2.0, 12.0.1) and dates (for example, YY-MM-DD). I was thinking of two solutions:
+---+---+-----+-----------+ +-----+-----+-----+-----+ +-----+--------+
|...|...|id |versionType| |id |major|minor|build| |id |date |
|---+---+-----+-----------| |-----+-----+-----+-----| |-----+--------|
|...|...|12345|0 | |12345|0 |1 |2 | |21432|12-04-05|
|---+---+-----+-----------| +-----+-----+-----+-----+ +-----+--------+
|...|...|21432|1 |
+---+---+-----+-----------+
or
+---+---+-----+-----+-----+-----+--------+
|...|...|id |major|minor|build|date |
|---+---+-----+-----+-----+-----+--------|
|...|...|12345|0 |1 |2 |null |
|---+---+-----+-----+-----+-----+--------+
|...|...|21432|null |null |null |12-04-05|
+---+---+-----+-----+-----+-----+--------+
None of them looks particularly effective: the first requires the union of two tables to get the version number, and the second - twice as much space for recording the version as compared to the first. Alternatively, I could just store the value in a number of bits in a column and then interpret it on the client side, but I hope there is some standard practice for this situation that I have missed.
Is there a way to store two different data types for the same column in a relational database?