In this tutorial we will learn about of the commonly used data types in PostgreSQL.
About Data Types
Data types tells us about the type of data that is stored in a column.
Following are some of the commonly used data types in PostgreSQL.
- Numeric Type
- Boolean Type
- UUID Type
- XML Type
- JSON Type
- Monetary Type
- Character Type
- Binary Type
- Date/Time Type
Numeric Type
Numeric types helps us to store numbers. The following table lists the different numeric types.
Integer
These data types are used to store integer values like -2, 0, 10 etc.
Data Type | Size (byte) | Min value | Max value |
---|---|---|---|
smallint | 2 | -32768 | +32767 |
integer | 4 | -2147483648 | +2147483647 |
bigint | 8 | -9223372036854775808 | +9223372036854775807 |
Numeric and Decimal
Numeric and Decimal are of variable size as the precision is user specified.
Data Type | Size (byte) | Range |
---|---|---|
numeric | variable | up to 131072 digits before the decimal point; up to 16383 digits after the decimal point |
decimal | variable | up to 131072 digits before the decimal point; up to 16383 digits after the decimal point |
No comments:
Post a Comment