The query ran clean, but the answer was wrong. The table was missing a field. You need a new column.
Adding a new column seems simple, but modern applications demand more than just ALTER TABLE. The wrong move can lock writes, break deployments, or cause silent data drift. Done right, it’s instant. Done wrong, it’s downtime and rollback.
First, define the exact schema change. Decide on the column name, type, nullability, and default value. Document these before executing anything in production. Mismatched assumptions between environments introduce bugs you might not see for weeks.
Second, use the safest migration strategy available. Many relational databases allow adding a nullable column without locking. For large datasets, avoid adding a column with a default value in a single step—this can rewrite the whole table. Instead, create the column as null, then backfill data in small batches.