(mysql.info.gz) Choosing types
Info Catalog
(mysql.info.gz) Storage requirements
(mysql.info.gz) Column types
(mysql.info.gz) Other-vendor column types
11.6 Choosing the Right Type for a Column
=========================================
For the most efficient use of storage, try to use the most precise type
in all cases. For example, if an integer column will be used for values
in the range from `1' to `99999', `MEDIUMINT UNSIGNED' is the best
type. Of the types that represent all the required values, it uses the
least amount of storage.
Accurate representation of monetary values is a common problem. In
MySQL, you should use the `DECIMAL' type. This is stored as a string,
so no loss of accuracy should occur. (Calculations on `DECIMAL' values
may still be done using double-precision operations, however.) If
accuracy is not too important, the `DOUBLE' type may also be good
enough.
For high precision, you can always convert to a fixed-point type stored
in a `BIGINT'. This allows you to do all calculations with integers and
convert results back to floating-point values only when necessary.
Info Catalog
(mysql.info.gz) Storage requirements
(mysql.info.gz) Column types
(mysql.info.gz) Other-vendor column types
automatically generated byinfo2html