Altertablestudentmodif"/> Altertablestudentmodif">

Home  >  Article  >  Database  >  How do we modify columns of MySQL table?

How do we modify columns of MySQL table?

WBOY
WBOYforward
2023-09-13 23:09:02908browse

How do we modify columns of MySQL table?

By using the MODIFY keyword and the ALTER TABLE command, we can modify the columns of a MySQL table. The syntax is as follows;

Syntax

Alter table table_name MODIFY column_name1 datatype, MODIFY column_name2 datatype… MODIFY column_nameN datatype);

Example

In the following example, the "Address" and "Grade" columns are modified with the help of the MODIFY keyword in the ALTER command the size of.

mysql> Alter table student modify address varchar(45),Modify Grade Varchar(15);
Query OK, 5 rows affected (0.38 sec)
Records: 5 Duplicates: 0 Warnings: 0

The above is the detailed content of How do we modify columns of MySQL table?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete