Creating a new column sounds simple, but performance, migration safety, and schema design make it a decision worth precision. In SQL, a new column changes the structure of the table. Every query, index, and downstream system may feel the impact.
The most direct way:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This works, but on large datasets, it may block writes or reads until the operation completes. Systems with high concurrency need a plan that avoids downtime. Online schema changes or rolling deployments can add a new column without killing throughput.
Naming matters. A good column name is short, descriptive, and stable across revisions. Type selection matters more. Choose the smallest type that fits the data. Avoid TEXT if VARCHAR(255) is enough. Use BOOLEAN or ENUM for constrained sets.
When adding a new column in application code, keep backward compatibility. Migrations should be reversible. Defaults should be explicit. Nullability determines whether existing rows break. For a nullable column: