The simple Syntax of MySQL is commonly used, but it is not easy to remember. Of course, these SQL syntaxes are basically common in various databases. Listed below:
1. Add a field
Alter table user add column new1 varchar (20) default null; // Add a field, empty by default
Alter table user add column new2 varchar (20) not null; // Add a field, which cannot be blank by default.
2. delete a field
Alter table user drop column new2; // delete a field
3. modify a field
Alter table user modify new1 varchar (10); // modify the type of a field
Alter table user change new1 new4 int; // modify the name of a field. You must specify the field type again.
Author'sArticleAll original, spend a lot of energy and time, here I beg you can take care of my shop: http://wamogu.taobao.com. Adding a page view is the greatest comfort to the work of the author. Thank you for taking the mouse off.