The query ran, but the result was wrong. You scan the table. The fields are old, rigid, and blind to what you need. The answer is simple: add a new column.
A new column changes the shape of your data. It can store fresh metrics, track state, or optimize queries that have slowed to a crawl. In SQL, it is direct:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
The command locks the table, updates the schema, and unlocks it. On small datasets, this is instant. On large ones, it can block writes. Plan for this. Test before production.
In PostgreSQL, use ADD COLUMN for most cases. For MySQL, check storage engine limits. In distributed databases, schema changes can cascade across nodes; know how your system handles replication lag. Keep indexes in mind — adding a column is cheap, but indexing it is not.
A new column is not just an empty slot. Decide the type. Set defaults if old rows need values. Use NULL only when absence is valid. A mistake here can bloat storage or break constraints.