Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

postgres alter table add column with default value

ALTER TABLE <TableName> ADD COLUMN <ColumnName> <ColumnType> NOT NULL default <DefaultValue>;

ALTER TABLE customers ADD COLUMN phone integer NOT NULL default 0;
ALTER TABLE customers ADD COLUMN gender varchar(255) NULL default 'Other';
 
PREVIOUS NEXT
Tagged: #postgres #alter #table #add #column #default
ADD COMMENT
Topic
Name
7+3 =