The query ran. The table stared back, unchanged. You needed a new column, and you needed it now.
Adding a new column should be simple. In SQL, it starts with ALTER TABLE. You define the column name, type, and constraints. For example:
ALTER TABLE users
ADD COLUMN last_login TIMESTAMP DEFAULT CURRENT_TIMESTAMP;
The database locks just enough to update metadata. In OLTP systems, this is fast. In large warehouses, the operation may be costly—some engines rewrite the entire table. Choose the right migration strategy. For massive datasets, consider partitioned tables, zero-copy clones, or schema evolution tools to avoid downtime.
Schema changes are not just syntax. They change the shape of your data model. Every new column has implications for indexes, queries, and storage. Adding a column with a default value might rewrite all rows. Adding one without a default may produce NULLs that break application logic. Always check your application code and tests before deploying.