Data Types
Just like any other programming language, databases have predefined data types for storing information.
There are many data types in a database, but let’s cover the most basic ones for now.
Numeric Types
integer: The most basicwhole numbertype. It can store numbers from approximately -2.1 billion to 2.1 billion.bigint: Used when you need to store very large integers. It can store numbers from approximately -9.22 quintillion to 9.22 quintillion.
Character (String) Types
text: The most recommended character type in PostgreSQL. It can store very long sentences without a character limit and offers excellent performance.varchar(n): Used when you want to limit the maximum number of characters. For example,varchar(10)allows a maximum of 10 characters.
Date and Time Types
date: Stores only the date. (e.g.,2026-02-08)timestamp: Stores both the date and time. (e.g.,2026-02-08 12:05:44)
Boolean Type
boolean: Can store only two values:trueorfalse. (e.g., ‘Payment completed?’, ‘Account deactivated?’)
These seven types are used very frequently, so it’s a good idea to take a moment to memorize them.
Now, let’s try creating a table using these data types.