How to Add a Column in Snowflake using Alter Table
Adding a column in Snowflake involves using the ALTER TABLE
command.
Adding a brand_id smallint column:
alter table products
add brand_id smallint;
Adding a brand_id smallint column with a default value:
alter table products
add column brand_id smallint default 1;
Adding a string (varchar) column with a not null constraint:
-- note: this is possible only if the table contains no data!
alter table products
add description varchar(100) not null;
Adding more columns at the same time:
alter table products
add
brand_id smallint default 1,
description varchar(100) not null;
Finally, a unified workspace for your SQL development
Get more done, together, with PopSQL and Snowflake