Adding a new column is simple in concept, but the execution depends on the schema, constraints, and performance requirements. In SQL, use ALTER TABLE to define the new field. Name it precisely. Choose the correct data type. Decide if null values are allowed. Every choice affects how the database stores, indexes, and queries the data.
In PostgreSQL:
ALTER TABLE users ADD COLUMN last_login TIMESTAMP;
This modifies the table structure without rebuilding the dataset. If your table is large, watch for locks. In MySQL and other engines, syntax is similar but performance impacts vary. Always check the documentation for version-specific behavior.
Constraints deserve attention. A default value can prevent null clutter, but may slow the operation if applied to millions of rows. Indexes speed lookups but can extend migration times. Plan and test in staging before production changes.