Modifying the table structure in MySQL includes many functions. The following describes how to modify the table structure in MySQL to add and delete fields. If you are interested in modifying the table structure in MySQL, take a look.
Modify Table Structure in MySQL -- add fields:
Alter table 'user _ movement_log'
Add column GatewayId int not null default 0 AFTER 'regionid' (AFTER which field is added)
Modify Table Structure in MySQL -- delete fields:
Alter table 'user _ movement_log 'drop column Gatewayid
Adjust the field order:
Alter table 'user _ movement_log 'CHANGE 'gatewayid' int not null default 0 AFTER RegionID
// Primary key
Alter table tabelname add new_field_id int (5) unsigned default 0 not null auto_increment, add primary key (new_field_id );
// Add a new column
Alter table t2 add d timestamp;
Alter table infos add ex tinyint not null default '0 ′;
// Delete a column
Alter table t2 drop column c;
// Rename a column
Alter table t1 change a B integer;
// Change the column type
Alter table t1 change B bigint not null;
Alter table infos change list tinyint not null default '0 ′;
// Rename the table
Alter table t1 rename t2;
10 common MySQL command lines
Use the MySQL command line to change the password
Cancel MySQL user permissions
Commands that grant MySQL user permissions
Mysql index Comparison Analysis