Numeric Data Types

There are a few top level data types to store numbers. There are integers and decimal which stores actual values. And there is also floating types that store approximations. It looks like you got to know the details for subtypes of these main ones.

For integer types, there are four subtypes. TINYINT only uses 1 byte of storage. It stores positive numbers between - and 256. Then there is SMALLINT, which takes up 2 bytes of storage. Values stored in it range from -32767 to 32768. The INT type uses 4 bytes of storage. Its values range from about -2M to 2M. Finally there is BIGINT, which takes up 8 bytes of storage. It stores huge numbers.

Next there is the DECIMAL data type. You need to specify the precision and scale for this type. Precision is the total number of numeric digits stored for the value. And scale is how many of those digits are to the right of the decimal point.

There are two type of floating types for numbers. FLOAT24 uses 4 bytes of storage. It has a precision of 7. This type is also known as FLOAT or REAL. Then there is FLOAT53. It requires 8 bytes of storage. Both of these floating types can store really small or really large numbers. But they are just approximations. In general, you should not use this data type if you require accuracy.