Adding a new column sounds simple, but the difference between doing it right and doing it fast matters. Schema changes can be harmless in development and dangerous in production. The wrong approach locks a table, blocks writes, and stalls the application. The right approach runs online, keeps performance stable, and rolls out without downtime.
A new column in SQL is created with the ALTER TABLE statement. For many engines, the basic syntax is:
ALTER TABLE table_name ADD COLUMN column_name data_type;
This works for small datasets. On large tables, this can take hours. For PostgreSQL, adding a nullable column with a default value is a common trap. It rewrites every row. Instead, add it as nullable first, backfill in batches, then set the default.
For MySQL and MariaDB, online DDL operations can be enabled to add a new column without locking the table. Use ALGORITHM=INPLACE or ALGORITHM=INSTANT where supported. Always check the server version and engine capabilities.