Modifying the data type of a column name or column in MySQL(2012-04-03 08:59:25)
reproduced
Tags: mysql modify column name modify column data type it |
Category: Databases |
Refer to the syntax in the links below
Http://dev.mysql.com/doc/refman/5.0/en/alter-table.html
Methods to modify only the data type of a column:
Can usually be written as ALTER TABLE name modify column column name new type
For example: The type of column sname in the student table is char (20), which is now modified to varchar, the SQL statement is as follows
ALTER TABLE student Modify column sname varchar (20);
Methods for modifying the data types of column names and columns at the same time:
Can usually be written as ALTER TABLE name change column old column name new column type
For example: The type of column sname in the student table is char (20), which is now modified to stuname varchar, the SQL statement is as follows
ALTER TABLE student Change column sname stuname varchar (20);
MySQL modifies column names and column types