What should I do if I want to implement MYSQL to modify the table structure? You can use ALTER to modify the table structure in MYSQL. The following describes the detailed method for your reference.
Mysql alter table structure usage
Project instance:
Alter table TestResult ADD xinlinDoc longblob;
Alter table TestResult ADD xinlinDocName varchar (50 );
Other instances:
Create table t1 (a INTEGER, B CHAR (10); // The created TABLE t1 starts.
Alter table t1 RENAME t2; // RENAME the TABLE from t1 to t2
Alter table t2 MODIFY a tinyint not null, CHANGE B c CHAR (20); // to CHANGE column a from INTEGER to tinyint not null (same name), and CHANGE column B, change from CHAR (10) To CHAR (20), rename it, and change from B to c:
Alter table t2 ADD d TIMESTAMP; // ADD a new TIMESTAMP column named d
Alter table t2 add index (d), add primary key (a); // ADD an INDEX on column d and set column a as the PRIMARY KEY
Alter table t2 drop column c; // delete COLUMN c
Alter table t2 ADD c int unsigned not null AUTO_INCREMENT, add index (c); // ADD a new AUTO_INCREMENT integer column named c. Note that we have indexed c, because the AUTO_INCREMENT column must be indexed, and we declare c as not null, because the indexed Column cannot be NULL. When you add an AUTO_INCREMENT column, the column values are automatically entered with sequential numbers.
The preceding describes how to use ALTER to modify the table structure in MYSQL.
Add new users through MySQL Command Line
MySQL permission table Introduction
Instances that grant MySQL user permissions
Eight things to pay attention to in MySql Indexes
How to view MySQL Indexes