The query ran clean, but the output was wrong. A new column appeared in the dataset—unplanned, untracked, and full of questions.
When you add a new column, you change the structure of your data. It affects queries, indexes, and application logic. If the column is required, every insert will fail until code is updated. If it has a default, you must confirm the default will not corrupt downstream logic. In high-load systems, a new column can change row size and slow reads.
Plan the schema change. Decide the column name, type, nullability, and default values. In SQL, ALTER TABLE adds it:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP DEFAULT NULL;
Run this in a transaction when possible, but beware: large tables can lock and block writes. Consider ONLINE or CONCURRENT options where the database allows it. Test migration scripts in staging with production-like data. Measure query performance before and after.