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;
Real-time SQL collaboration is here
Get started with PopSQL and PostgreSQL in minutes