The query finished running, but the data wasn’t complete. You scan the schema, and the answer hits you—what you need is a new column.
Adding a new column is one of the simplest database schema changes, but it carries real consequences for performance, code consistency, and future migrations. Whether you work with PostgreSQL, MySQL, or SQLite, the ALTER TABLE statement is the starting point.
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This command creates a new column named last_login with a TIMESTAMP type in the users table. On small datasets, it’s immediate. On large, production-scale tables, it can lock writes and slow queries. Always run schema changes in a controlled migration process, and, when possible, test against a staging environment.
Plan for defaults and null values. When you add a new column with a NOT NULL constraint, every existing row must have a value. Without a default, this can fail or require a full table rewrite. Setting a default can fill data instantly but might hide bugs if the default value is not meaningful.