Adding a new column changes the schema. It changes queries, performance, and the way data flows through code. Done right, it extends capability without breaking what exists. Done wrong, it burns hours on debugging and migration.
A new column in SQL, whether in PostgreSQL, MySQL, or any other relational database, starts as a schema change. The ALTER TABLE command is the core tool:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
But this is not just syntax. You must consider indexing. Indexing a new column improves query speed, but adds write overhead. If the column is read often, the index is worth it. If it is updated frequently, test the impact before committing.
Nullability matters. Adding a non-nullable new column to a table with millions of rows forces you to set a default value instantly. This can lock tables and slow production systems. Many engineers use a phased approach: