Adding a new column is simple in concept but decisive in execution. It changes structure, performance, and workflow. In SQL, the ALTER TABLE command is the standard. You name the table, define the column, and set the type. Example:
ALTER TABLE orders
ADD delivery_date DATE;
This statement runs fast on small tables. On large ones, it can lock rows, block writes, and slow queries. Plan the timing. Test on staging. For systems with millions of rows, use tools like pt-online-schema-change or native database features for online migrations.
In PostgreSQL, adding a column with a default non-null value rewrites the entire table. Avoid this if speed matters. First add the column as nullable, then backfill in small batches. Finally, apply NOT NULL and the default. This sequence keeps downtime close to zero.
In MySQL, ALTER TABLE also has locking modes. Use ALGORITHM=INPLACE when you can. It reduces blocking, but the exact behavior depends on storage engine and version.