On the difference between change and modify MySQL in the

MySQL version

show variables like 'version';

Table Structure

desc student;

Modify table

For example: modify the student table name field, the varchar (10) modified to VARCHAR (20 is)
Modify
alter table student modify name varchar(20);

change
alter table student change name name varchar(20);

Modify the column name

Modify the column name change can only be used to modify
, for example: the name of the column name changed to username

From the above it can be found modify and change can modify the definition of the table, but change it takes to write the column name twice, not very convenient. But the advantage is that change can modify the column name, modify can not

Guess you like

Origin www.cnblogs.com/liuurick/p/11627109.html