MySQL adds fields to the method is not complicated, the following will give you a detailed description of the MySQL add fields and modify the fields and other operations to implement the method, I hope you learn to add fields in MySQL will be helpful.
1. Log in to the database
>mysql-u root-p Database name
2. Querying all data Sheets
>show tables;
3. Querying the table for field information
>DESC table name;
4.1 Adding a table field
ALTER TABLE table1 add transactor varchar (ten) not Null;
ALTER TABLE table1 add ID int unsigned not Null auto_increment primary key
4.2. Modify the field type of a table and specify null or non-empty
>alter Table name change field Name field Name field type [whether non-null allowed];
>alter Table name Modify field Name field type [allow non-null];
>alter Table name Modify field Name field type [allow non-null];
4.3. Modify the field name of a table and specify null or non-empty
>alter Table name change field original Name field new Name field type [whether non-null is allowed
4.4 If you want to delete a field, you can use the command: ALTER TABLE mytable DROP field name;
This article is from the "My Ops Time" blog, so be sure to keep this source http://aaronsa.blog.51cto.com/5157083/1746865
Ways to add fields and modify fields in MySQL