Adding a new column in a relational database is simple in syntax but critical to get right. The ALTER TABLE statement is the standard way. For example:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This command updates the schema. It does not automatically update existing rows. You must decide on defaults or backfill values before adding constraints. For large datasets, locking and migration time can cause downtime. To avoid blocking writes, use online schema change tools like pt-online-schema-change or native database features such as ALTER TABLE ... ALGORITHM=INPLACE in MySQL or ALTER TABLE ... ADD COLUMN with NOT NULL and DEFAULT in PostgreSQL carefully planned.
Name the new column with clarity. Avoid reserved words. Keep to snake_case or a consistent naming pattern. Index new columns only if needed, as each index increases write latency and disk usage.
When adding a computed column, use database-generated columns or store precomputed values if query performance must be instant. For analytics, a new column might store denormalized data, but track the cost of duplication in writes.