Data Types Overview: INT VARCHAR DATE BOOLEAN
Learn the core SQL data types: integers, varchar/text, dates and timestamps, booleans, and decimals, and how to pick the right type for each column.
Why Types Matter
Every column has a fixed type. The type defines:
- What values are valid
- How much storage each row uses
- Which operators and functions apply
- How the planner picks indexes and joins
Integer Types
PostgreSQL has three integer sizes:
SMALLINT -- 2 bytes, -32768 to 32767
INTEGER -- 4 bytes, ±2.1 billion (alias: INT)
BIGINT -- 8 bytes, ±9.2 quintillion
-- Auto-incrementing variants:
SMALLSERIAL BIGSERIAL SERIALAll lessons in this course
- What an RDBMS Is and Why Tables Matter
- Primary Keys and Uniqueness
- NULL: The Third Truth Value
- Data Types Overview: INT VARCHAR DATE BOOLEAN