PopSQL

How to Add a Column in PostgreSQL

Here's an example of adding a created_at timestamp column to your users table in PostgreSQL.

alter table users add column created_at timestamp without time zone;

Adding a string (varchar) column with a not null constraint:

alter table users add column bio character varying not null;

Adding a boolean column with a default value:

alter table users add column active boolean default true;

For reference, check out the full list of Postgres data types.

database icon
Shared queries and folders ✅ Version history ✅ One-click connection to PostgreSQL ✅
Get more done, together, with PopSQL and PostgreSQL