How to Modify the Column in the Table in MySQL?

3) MODIFY column in the table

The MODIFY command is used to change the column definition of the table.

Syntax:

ALTER TABLE table_name
MODIFY column_name column_definition
[ FIRST | AFTER column_name ];

Example:

In this example, we modify the column cus_surname to be a data type of varchar(50) and force the column to allow NULL values.

Use the following query to do this:

ALTER TABLE cus_tbl
MODIFY cus_surname varchar(50) NULL;

mysql alter table 5

See the table structure:

mysql alter table 6