Skip to main content
World Nomads Logo

How to Modify column definition 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; 
4) DROP column in table

Syntax:

ALTER TABLE table_name 
DROP COLUMN column_name; 
Let's take an example to drop the column name "cus_address" from the table "cus_tbl".

Use the following query to do this:

ALTER TABLE cus_tbl 
DROP COLUMN cus_address;

Continue...

Subscribe channel on YouTube
Read this post on Blogger
Like page on Facebook
Tweet about video on twitter
Let's chat on whatsapp
See you at Instagram
Google+

Comments

Contact Us

Name

Email *

Message *