A new column can change the shape of your data, the speed of your queries, and the integrity of your system. In SQL, adding a column is simple, but the consequences ripple across code, APIs, and storage. Done right, it strengthens your schema. Done wrong, it breaks production.
Use ALTER TABLE to add a new column:
ALTER TABLE users
ADD COLUMN last_login TIMESTAMP DEFAULT CURRENT_TIMESTAMP;
This command is fast for small tables. On large datasets, it can lock writes, block reads, or trigger a table rewrite. Always measure the cost. Test in staging. If your database supports online schema changes, enable them.
When adding a new column, define constraints and defaults early. Decide if the column should allow NULL. Choose types and sizes with precision — over-allocating wastes storage and slows scans. Avoid changing column definitions later; migrations will be expensive.