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.
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!