The query runs. The table is clean. But it needs a new column.
Adding a new column in a production database should be fast, safe, and easy to roll back. The wrong approach can lock tables, block writes, or cause downtime. The right approach depends on the database engine, the size of the dataset, and whether users can tolerate temporary constraints.
In SQL, the basic syntax is direct:
ALTER TABLE table_name
ADD COLUMN column_name data_type;
This works for most smaller datasets. For large tables, use online schema changes when supported. PostgreSQL supports ADD COLUMN without rewriting the whole table unless you assign a default value. For MySQL, tools like gh-ost or pt-online-schema-change let you add a new column without blocking.