In database work, adding a new column is never just an afterthought. It changes the shape of your data. It alters queries, indexes, and application code. The correct approach depends on the database engine, the size of your tables, and the uptime requirements of your system.
In SQL, the core syntax is simple:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
But real systems are rarely simple. On large datasets, an ALTER TABLE can lock writes and degrade performance. In production, you must weigh schema changes against downtime. Many teams use online schema migration tools like pt-online-schema-change or gh-ost to add a new column safely.
Data type matters. Choosing VARCHAR when you need TEXT can create storage issues later. Adding a NOT NULL column to a populated table without a default value will fail in many engines. Plan for nullability, defaults, and indexing before you apply the change.
Indexes for a new column require more than adding CREATE INDEX. Each index has a cost in writes, storage, and cache usage. Avoid premature indexing and monitor query performance after deployment.