ALTER TABLE DROP COLUMN

Drops a column from a Delta table's schema using column mapping. The physical data remains in Parquet files.

Category: ddl

Syntax

ALTER TABLE <table> DROP COLUMN [IF EXISTS] <column>

Description

## Overview Removes a column from the Delta table schema. This is a logical operation that updates the schema metadata in the Delta log. The physical column data remains in the underlying Parquet files but becomes invisible to readers. ## Behavior - The column must exist in the current schema unless IF EXISTS is specified. Without IF EXISTS, a missing column causes an error. - With IF EXISTS, dropping a nonexistent column succeeds silently and returns a skip message. - The COLUMN keyword after DROP is optional. Both `DROP COLUMN col` and `DROP col` are accepted. - This operation requires column mapping mode to be enabled (`delta.columnMapping.mode = 'name'`). Without column mapping, the physical and logical column names are tied together and columns cannot be safely removed. - The physical data in Parquet files is not deleted or modified. Only the schema metadata is updated. The orphaned column data can be reclaimed by rewriting files (e.g., via OPTIMIZE or VACUUM after sufficient history). - A single commit is written to the Delta log. ## Compatibility Column dropping via column mapping is a standard Delta Lake feature. All Delta readers that support column mapping mode 'name' or 'id' will correctly exclude the dropped column from query results.

Parameters

NameTypeDescription
tableFully qualified table name or registered table name. The table must be registered in the current session.
column_nameColumn to drop.
if_existsDon't error if column doesn't exist.

Examples

-- Drop a column
ALTER TABLE warehouse.sales.customers DROP COLUMN temporary_field;
-- Drop a column using IF EXISTS
ALTER TABLE warehouse.sales.orders DROP COLUMN IF EXISTS legacy_status;
-- Drop without the optional COLUMN keyword
ALTER TABLE warehouse.sales.products DROP old_description;

Pitfalls

See Also

Open in interactive docs →   DeltaForge home →