php - How to store version number in MySQL database -
i want store version number of application in mysql database ex:
version 1.1.0 1.1.1 1.1.2
which data type should use.
you have 2 options:
use varchar
use 3 numeric fields, major, minor, patch
use both.
each option has advantages , disadvantages.
option 1 1 field, it's easy version. isn't sortable, since 2.0.0 lexicographically higher 10.0.0.
option 2 sortable, have 3 fields.
option 3 can implemented using view:
table tversion ( major number(3), minor number(3), patch number(3) ) view vversion select major || '.' || minor || '.' || patch version, major * 1000000 + minor * 1000 + patch sortorder tversion;
Comments
Post a Comment