Numeric Data Types in MySQL

MySQL provides exact integer and fixed-point types as well as approximate floating-point types. Select the type based on range, exactness and storage requirements.

Integer types

TypeBytesSigned rangeUnsigned range
TINYINT1-128 to 1270 to 255
SMALLINT2-32,768 to 32,7670 to 65,535
MEDIUMINT3-8,388,608 to 8,388,6070 to 16,777,215
INT4-2,147,483,648 to 2,147,483,6470 to 4,294,967,295
BIGINT8-2^63 to 2^63-10 to 2^64-1

DECIMAL for exact values

DECIMAL(M,D) stores exact fixed-point values. M is total precision and D is the scale.

price DECIMAL(10,2)

This is a common choice for currency-like values.

FLOAT and DOUBLE

FLOAT and DOUBLE are approximate floating-point types. Use them for scientific measurements where approximation is acceptable, not for values that require exact decimal arithmetic.

Older examples often use integer display widths such as INT(3). A display width does not restrict an integer to three digits and should not be used as a range rule.



Subscribe to our YouTube Channel here



plus2net.com




SQL Video Tutorials










✖
We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles Contact us
© 2000-2026 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer