1. MySQL > alter table table – add/drop columns

ALTER TABLE [table_name] addtest1; ALTER TABLE [table_name] droptest1;
Copy the code

Add primary key constraint:

Delete the primary key constraint

Add a unique constraint:

Delete a unique constraint:

Example:

Add a foreign key constraint:

Modify column definitions:

Change column name:

Conclusion: