Adding a new column is simple in theory, but in production it carries weight. Downtime, locks, migrations—each decision matters. In SQL, the ALTER TABLE statement is the standard. In PostgreSQL:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This creates the column without touching existing data. In MySQL, the syntax is similar:
ALTER TABLE users ADD COLUMN last_login DATETIME;
But not all databases handle schema changes the same. Some block writes during the operation. Others rebuild indexes. On large datasets, adding a column can take minutes or hours depending on engine, storage, and constraints.
A new column with a default value can be dangerous. PostgreSQL, for example, rewrites the whole table if you add a column with a non-null default in older versions. Modern releases optimize this, but test before deploying. On distributed databases, schema changes may need to be coordinated across nodes to avoid version mismatches.