Mega Code Archive

 
Categories / MySQL Tutorial / Data Types
 

Numeric Types

Type Name Value Range Unsigned TINYINT-128 to 1270-255 SMALLINT-32768 to 327670-65535 MEDIUMINT-8388608 to 83886070-16777215 INT-2147483648 to 21474836470-4294967295 BIGINT-9223372036854775808 - 92233720368547758070-18446744073709551615 FLOAT(M,D)Varies depending on valuesVaries depending on values DOUBLE(M,D)Varies depending on valuesVaries depending on values DECIMAL(M,D)Varies depending on valuesVaries 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.