ALTER TABLE MODIFY COLUMN
ALTER TABLE MODIFY COLUMN is a SQL statement in the DDL Statements category. Changes the data type or constraints of an existing column. The syntax is ALTER TABLE table_name MODIFY [COLUMN] column_name new_datatype;. It returns modified column. A typical example: ALTER TABLE employees MODIFY COLUMN salary DECIMAL(12,2); -- Widen the salary column ALTER TABLE employees MODIFY COLUMN name VARCHAR(200) NOT NULL; -- Change type and add NOT NULL 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 ALTER TABLE, which modifies an existing table: add/drop columns, modify data types, rename, add/drop constraints. A close relative is DROP TABLE, which permanently removes a table and all its data from the database. Cannot be undone. More about this category: Data Definition Language — CREATE TABLE, ALTER TABLE, DROP TABLE, TRUNCATE, CREATE INDEX.