How to Add a Default Value to a Column in PostgreSQL

-- Example: Orders have a default total of 0 cents
alter table orders alter column total_cents set default 0;

-- Example: Items are available by default
alter table items alter column available set default true;
database icon
Finally, a unified workspace for your SQL development
Get more done, together, with PopSQL and PostgreSQL