Home  >  Article  >  Database  >  How to change the data type of a column in mysql

How to change the data type of a column in mysql

王林
王林Original
2020-10-13 16:51:046848browse

Mysql method to change the data type of a column: directly execute the [alter table table name modify column column name new column type] statement.

How to change the data type of a column in mysql

Method to modify the data type of a column

(Recommended tutorial: mysql video tutorial)

alter table 表名 modify column 列名 新的列的类型

Example:

The type of column stu_name in the student table is char(20). Now it needs to be changed to varchar(20). The SQL statement is as follows:

alter table student modify column stu_name varchar(20);

Related recommendations: mysql Tutorial

The above is the detailed content of How to change the data type of a column in mysql. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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