The database table was perfect until the moment it wasn’t. You needed a new column. Not tomorrow. Not after a design meeting. Now.
Adding a new column should be fast, predictable, and safe. In SQL, the basic syntax is simple:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
That command updates the schema. The challenge is everything around it—migration timing, data backfill, and production stability. On small tables, the change is instant. On large tables, it can lock writes or blow up replication lag. That’s when schema changes stop being trivial and start being dangerous.
A new column can be NULL by default to avoid rewriting the entire table. If you need a non-null column with a default value, be careful. Some databases copy each row during the change. Postgres 11+ optimizes non-null defaults, but older versions do not. In MySQL, adding a column without AFTER or FIRST is efficient, but adding it in the middle can be costly.