The database waited. Your query ran, but the result was wrong. A missing field. An incomplete record. The answer was simple: you needed a new column.
Adding a new column is one of the most common schema changes. It also carries hidden costs. The moment you alter a table in production, you risk downtime, locks, or slow queries. On small datasets, this is trivial. On large datasets, it can be dangerous. Knowing how to add a new column without breaking production is vital for fast, safe deployments.
In most SQL databases, ALTER TABLE is the command. The syntax is simple:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
The complexity is in execution. On MySQL, older versions lock the table during the modification. PostgreSQL adds most columns instantly if they have no default value. Adding a default or a NOT NULL constraint may require touching every row. On high-traffic systems, this can block reads and writes.