Home > Database > Mysql Tutorial > body text

How do we modify columns of MySQL table?

WBOY
Release: 2023-09-13 23:09:02
forward
933 people have browsed it

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);
Copy after login

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. < /p>

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
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template