</>
Skip to content
PostgreSQL lessons (8/38)

PostgreSQL — Data Types

Numeric Types

TypeDescription
SMALLINT2 bytes
INTEGER4 bytes
BIGINT8 bytes
DECIMALExact numeric
NUMERICExact numeric
REALFloating point
DOUBLEDouble precision

String Types

TypeDescription
VARCHAR(n)Variable length
CHAR(n)Fixed length
TEXTUnlimited length

Date/Time Types

TypeDescription
DATEDate only
TIMETime only
TIMESTAMPDate and time
INTERVALTime interval

Boolean

is_active BOOLEAN DEFAULT true

Array

tags TEXT[] ARRAY

JSON

data JSONB

UUID

id UUID DEFAULT gen_random_uuid()

Mini Practice

  1. Use numeric types
  2. Use string types
  3. Use date types
  4. Use special types

Up Next

Continue with Insert — inserting data.

Related Topics

Frequently Asked Questions about Data Types

What is Data Types in PostgreSQL?

Data Types is a fundamental concept in PostgreSQL. This lesson explains it step by step with clear examples, making it easy for beginners to understand.

How do I learn Data Types?

Start by reading the explanation above, then try the code examples. Practice by modifying the examples and experimenting with different values. Hands-on practice is the best way to learn Data Types.

Why is Data Types important in PostgreSQL?

Data Types is essential for PostgreSQL development. Understanding this concept will help you write better code and solve real-world problems more effectively.