The database was ready, but the table was missing one thing—a new column that could change the flow of data forever. You know this moment. A feature turns, requirements shift, and you must alter the schema without slowing production. The command is simple, but the consequences are wide.
A new column in SQL is not just structure. It is capacity. It holds new data, enables new queries, and unlocks new code paths. Adding a column should be fast, safe, and deliberate. Done wrong, it locks tables, burns CPU, or risks downtime. Done right, it slides into place and works from the next commit forward.
To add a new column, most use ALTER TABLE. It is direct:
ALTER TABLE users
ADD COLUMN last_login TIMESTAMP DEFAULT NOW();
This creates the column with a default value for every row. Your database engine will decide how to apply it. In large datasets, adding a column with a non-null default can trigger a full table rewrite. This takes time. On highly active tables, it can block writes. Use caution.
If your platform supports it, add the column as nullable first: