Creating a new column in a database is simple in syntax but heavy with consequences. In SQL, the ALTER TABLE statement is the direct way to add one. For example:
ALTER TABLE users
ADD COLUMN last_login TIMESTAMP DEFAULT CURRENT_TIMESTAMP;
This command tells the database to modify its internal structure. The new column becomes part of every row, with a defined type and optional default value. When designing this change, think through NULL allowances, indexes, and constraints. A careless addition can cause more trouble than the bug you set out to fix.
In most production systems, downtime is unacceptable. Adding a new column on a large table can lock writes. Mitigate this by testing in staging, using online schema change tools, or applying non-blocking migrations. For PostgreSQL, ADD COLUMN with a constant DEFAULT is fast in recent versions, but adding a large defaulted value can still be expensive. For MySQL, tools like gh-ost or pt-online-schema-change help reduce impact on high-traffic tables.