Home > Database > Mysql Tutorial > body text

How to change the data type of a column in mysql

王林
Release: 2020-10-13 16:51:04
Original
6833 people have browsed it

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 列名 新的列的类型
Copy after login

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

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!

Related labels:
source:php.cn
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!