Numeric Types : Introduction : Data Types MySQL TUTORIALS


MySQL TUTORIALS » Data Types » Introduction »

 

Numeric Types


Type Name Value Range Unsigned
TINYINT -128 to 127 0-255
SMALLINT -32768 to 32767 0-65535
MEDIUMINT -8388608 to 8388607 0-16777215
INT -2147483648 to 2147483647 0-4294967295
BIGINT -9223372036854775808 - 9223372036854775807 0-18446744073709551615
FLOAT(M,D) Varies depending on values Varies depending on values
DOUBLE(M,D) Varies depending on values Varies depending on values
DECIMAL(M,D) Varies depending on values Varies depending on values


If the column is numeric and declared UNSIGNED, the range doubles for the given type.

FLOATs, DOUBLEs, and DECIMALs can hold fractions.

The other types cannot.

The first number is the number of digits for the whole number and the second is the number of digits for the fraction.

You can limit the number of digits to the right of the decimal point.

For 5.6876, FLOAT(4,2) type column would store 5.69.

FLOAT(4,3) would be store 5.688.

MySQL rounds the decimal to fit the number of digits right of the decimal point.




Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Data Types
» Introduction