Comparison · Designing databases

ADD COLUMN vs changing a column

ADD COLUMN creates a new column. ALTER COLUMN or MODIFY COLUMN changes an existing one, with syntax that varies by engine.

Before continuing: This entry is part of the ALTER TABLE guide. If you are new to the topic, start with ALTER TABLE.

Examples

Widely recognised syntax
ALTER TABLE products
ADD COLUMN weight_kg DECIMAL(6,2);

The table gains a new column. Existing rows will hold NULL unless a compatible default has been declared. Adding the column does not convert or replace any other column.

The result confirms that ADD COLUMN extends the schema without inventing data. If the column must be required, fill in valid values first and then add the constraint with your engine's syntax.

Differences and trade-offs

How to choose

QuestionOperationExample
The column does not exist yet?ADD COLUMNAdd weight_kg
It exists and its type changes?ALTER/MODIFY COLUMNprice moves to a higher precision
Only the name changes?Dedicated renamephone becomes moving
Want to change the values?UPDATEFill in empty phone numbers

Example 2: changing an existing column

PostgreSQL
ALTER TABLE products
ALTER COLUMN price TYPE NUMERIC(12,2);
MySQL 8.4
ALTER TABLE products
MODIFY COLUMN price DECIMAL(12,2) NOT NULL;
SQL Server
ALTER TABLE products
ALTER COLUMN price DECIMAL(12,2) NOT NULL;

The three statements express a similar intent, but they are not interchangeable. In MySQL, the definition written in MODIFY COLUMN must restate any properties you want to keep, such as NOT NULL. PostgreSQL may need a USING clause if the values have no suitable implicit conversion.

What happens in SQLite

SQLite directly supports ADD COLUMN, renames and DROP COLUMN. Since SQLite 3.53.0, released on 9 April 2026, it also supports ALTER TABLE ... ALTER COLUMN ... SET/DROP NOT NULL. There is still no generic command to change a column's type and all its properties at will. The site's lab checks ADD COLUMN; for unsupported changes, follow the documented procedure: create a new table, copy the data, validate it and replace the old table.

Before changing a type

  1. Find the minimum and maximum values and the formats in use.
  2. Look for values that cannot be converted.
  3. Review indexes, keys, views and dependent code.
  4. Estimate whether the engine will copy or rewrite the table.
  5. Test the migration and its rollback on a representative copy.