Adding a new column in a database changes the schema, the queries, and the future of the application. It is a minor operation in code but a major point in data shape. Whether this column stores metrics, flags, or JSON, its creation must be exact and safe.
The most common way to add a new column is through an ALTER TABLE statement. In PostgreSQL:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This command extends the table without losing existing data. In MySQL, the syntax is almost identical. In modern migrations, frameworks like Django, Rails, or Prisma generate the command for you. They wrap it in transactions to maintain integrity.
There are risks. A new column can lock the table during the migration. Large datasets may stall writes. Adding with a default value can be slow if the database must touch every row. Best practice is to add the column as nullable, backfill in batches, then enforce constraints.