ALTER TABLE … ADD COLUMN inserts one or more new columns into an existing BigQuery table without rewriting the whole table.
It appends new fields to an existing BigQuery table, preserving all current data and schema. No data rewrite or downtime occurs, so the table stays query-able.
Use ALTER TABLE dataset.table ADD COLUMN column_name data_type. Include IF NOT EXISTS to avoid errors when the column is already there.
ALTER TABLE ecommerce.Customers
ADD COLUMN IF NOT EXISTS phone STRING;
Yes—separate definitions with commas.
ALTER TABLE ecommerce.Products
ADD COLUMN IF NOT EXISTS color STRING,
ADD COLUMN IF NOT EXISTS weight FLOAT64;
BigQuery lets you add column options such as DEFAULT expressions and NOT NULL constraints in the same statement.
ALTER TABLE ecommerce.Orders
ADD COLUMN IF NOT EXISTS status STRING DEFAULT 'pending' NOT NULL;
No locks are taken; queries and inserts continue to run. The new column shows NULL (or its DEFAULT) for existing rows.
Use IF NOT EXISTS in migrations, add DEFAULT for new NOT NULL fields, and version-control schema changes alongside application code.
Existing rows receive NULL or the specified DEFAULT. No backfill occurs unless you run an UPDATE after the schema change.
No. ALTER TABLE applies only to physical tables. Update the view definition instead.
Use ALTER TABLE … ADD COLUMN field STRUCT. You cannot add a field directly to an existing STRUCT element.
Schema changes themselves are free. Only subsequent queries that reference the new column incur standard query costs.