Numeric datatypes store numbers. MySQL supports several numeric datatypes, each with a different range of numbers that can be stored in it. Obviously, the larger the supported range, the more storage space needed. In addition, some numeric datatypes support the use of decimal points (and fractional numbers) whereas others support only whole numbers. Table D.2 lists the frequently used MySQL numeric datatypes.
Note Signed Or UNSIGNED? All numeric datatypes (with the exception of BIT and BOOLEAN) can be signed or unsigned. Signed numeric columns can store both positive and negative numbers, unsigned numeric columns store only positive numbers. Signed is the default, but if you know that you'll not need to store negative values you can use the UNSIGNED keyword, doing so will allow you to store values twice as large. Tip Not Using Quotes Unlike strings, numeric values should never be enclosed within quotes. Tip Storing Currency There is no special MySQL datatype for currency values, use DECIMAL(8,2) instead. |