AdvancedBasic SELECT
ENUM Data Type
The query
SQL
CREATE TYPE task_status AS ENUM ('todo', 'in_progress', 'done');
CREATE TABLE tasks (
id SERIAL PRIMARY KEY,
title TEXT,
status task_status DEFAULT 'todo'
);Note
“ENUMs enforce data integrity at the database level. They are stored as integers internally, making them very space-efficient.