That single change can ripple through an application, break queries, demand migrations, and alter how data flows. In relational databases, adding a new column is more than a schema update — it’s a contract change between storage and code. Every decision here matters.
A new column must define its name, type, default value, and whether it allows nulls. In PostgreSQL, you might write:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP WITH TIME ZONE DEFAULT NOW();
This runs fast if the default is constant. But if the default depends on a function, the database may rewrite each row. On large tables, that is dangerous without careful planning. Use NULL plus an UPDATE in batches if downtime is not an option.
For MySQL, beware that ALTER TABLE can lock writes or rebuild the table, depending on engine and version. Always check execution plans, available ONLINE options, and ensure you run in a tested migration path.