Adding a new column is one of the most common schema changes in database work. It sounds simple. It is not. The wrong approach can lock your table, stall writes, and cause downtime. The right approach keeps production running and your users unaware anything happened.
First, define the exact purpose of the new column. Decide its data type, length, constraints, and default value. Avoid vague names; choose something explicit. Make sure it fits your naming conventions and indexing strategy.
In SQL, the basic syntax is direct:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
That command adds the column instantly on small tables. On large datasets, it may block queries. Use online schema change tools or database-specific features like ALTER TABLE ... ADD COLUMN with ONLINE in MySQL or ADD COLUMN in PostgreSQL combined with NULL defaults.