smallint | A 2-byte integer type. | 2 bytes | -32,768 to 32,767 | -100 , 0 , 20000 |
integer | A 4-byte integer type (default integer type). | 4 bytes | -2,147,483,648 to 2,147,483,647 | -5000 , 0 , 150000 |
bigint | An 8-byte integer type. | 8 bytes | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 | -1000000000 , 0 , 30000000000 |
decimal(p, s) | A numeric type with user-defined precision (p) and scale (s). | Variable | -10^38 +1 to 10^38 -1 with up to 38 digits of precision. | 123.45 , -987.654321 |
numeric(p, s) | Similar to decimal, with user-defined precision and scale, representing exact numeric values. | Variable | -10^38 +1 to 10^38 -1 with up to 38 digits of precision. | 123.456 , -12345.6789 |
real | A 4-byte single precision floating-point number. | 4 bytes | 1.701411734 × 10^38 (max) to -1.701411734 × 10^38 (min). | 3.14 , -0.001 , 2.71828 |
double precision | An 8-byte double precision floating-point number. | 8 bytes | 1.7976931348623157 × 10^308 (max) to -1.7976931348623157 × 10^308 (min). | 3.141592653589793 , -1.0E-5 |
serial | An auto-incrementing 4-byte integer type, often used for primary keys. | 4 bytes | Same as integer. | Automatically increments by 1 |
bigserial | An auto-incrementing 8-byte integer type, used for large-scale primary keys. | 8 bytes | Same as bigint. | Automatically increments by 1 |