Managing table columns (fields)

A statement that renames acolumn

ALTER TABLE customers MODIFY firstName VARCHAR(100) NOT NULL;

A statement that changes a column’s data type

ALTER TABLE customers MODIFY firstName CHAR(100) NOT NULL;

A statement that may cause data to be lost

ALTER TABLE customers MODIFY firstName VARCHAR(8);

A statement that sets a column’s default value

ALTER TABLE customers ALTER firstName SET DEFAULT '';

A statement that drops a column’s default value

ALTER TABLE customers ALTER firstName DROP DEFAULT;

Warning: You should never alter a table or other database object in a
production database without first consulting the DBA.

Back