Adding a new column is one of the most common schema changes. It can also be one of the most dangerous if you treat it like a quick edit. Schema changes lock tables. Locks block requests. Blocked requests mean outages.
The safe way to add a new column is to plan for it. Identify the exact type. Decide on defaults or nullability. Avoid backfilling large datasets in a single step. Run it in an isolated migration. In high-traffic systems, be ready to roll it out in two phases: first add the column without constraints or defaults, then update data in small batches, and finally add constraints if required.
In SQL, the basic syntax is simple:
ALTER TABLE table_name
ADD COLUMN column_name data_type;
In PostgreSQL, adding a column without a default is instant. Adding a default writes to every row and can lock the table. MySQL behaves differently at different version levels; online DDL can help, but you must verify its behavior on your exact release. Always test in a staging environment.