SQL Alter Table
ALTER TABLE changes an existing table definition. Treat a schema change as a small deployment: consider current rows, application compatibility, and how you will detect a problem after the change.
Understand the idea
Adding an optional column is a simple starting point. Existing customer rows receive NULL because no value or default was provided. Later statements can populate the column. Available ALTER operations vary across engines; SQLite supports fewer direct constraint changes than many server databases and may need a table-rebuild migration for more complex edits.
Where to try it
Run this example in the SQL playground. The lesson link loads the shop tables and sample rows before this query. Select Run when you are ready. Every run starts fresh, so your changes do not affect the website or a previous run.
SQLite sample data · MySQL / MariaDB sample data · See the sample tables
A worked example
ALTER TABLE customers ADD COLUMN phone TEXT;
UPDATE customers SET phone = 'demo-number' WHERE customer_id = 1;
SELECT name, phone FROM customers ORDER BY customer_id;
Read the result
Mira has the demo phone value, while the other customer rows have NULL. Existing names, cities, and identifiers remain present after the addition.
Try one change
Write a migration plan for adding a required phone_country column without breaking old application code in the middle of deployment.