After creating tables, you may need to modify their structure to accommodate changing data requirements.
The ALTER TABLE
statement lets you add, modify, or drop columns.
To add a new column, use:
ALTER TABLE table_name ADD COLUMN column_name data_type;
Example:
ALTER TABLE students ADD COLUMN email TEXT;
To remove a column:
ALTER TABLE table_name DROP COLUMN column_name;
Example:
ALTER TABLE students DROP COLUMN age;
Modifying tables allows your database to evolve as your application grows.