Adding a new column is one of the most common changes in database schema design. It sounds simple, but it can break production if done without care. The process depends on your database engine, migration tooling, and the size of your dataset.
In SQL, a new column is created with the ALTER TABLE statement. For example:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This command modifies the table definition without touching indexes or primary keys. Choosing the right data type matters. Define constraints early to avoid later corruption.
For large datasets in PostgreSQL or MySQL, adding a new column with a default value can trigger a full table rewrite. This locks the table and slows queries. To avoid downtime, add the column without a default, then backfill values in batches. Monitor query plans after deployment.