ALTER TABLE
ALTER TABLE is a SQL statement in the DDL Statements category. Modifies an existing table: add/drop columns, modify data types, rename, add/drop constraints. The syntax is ALTER TABLE table_name action;. It returns modified table. A typical example: ALTER TABLE employees ADD COLUMN phone VARCHAR(20); -- Add column ALTER TABLE employees MODIFY COLUMN salary DECIMAL(12, 2); -- Change type ALTER TABLE employees DROP COLUMN phone; -- Drop column ALTER TABLE employees RENAME TO staff; -- Rename table A close relative is CREATE TABLE, which creates a new table in the database with specified columns, data types, and constraints. A close relative is DROP TABLE, which permanently removes a table and all its data from the database. Cannot be undone. A close relative is TRUNCATE TABLE, which removes ALL rows from a table quickly. Unlike DELETE, cannot be rolled back in most databases. Resets AUTO_INCREMENT. More about this category: Data Definition Language — CREATE TABLE, ALTER TABLE, DROP TABLE, TRUNCATE, CREATE INDEX.