1. Create a table
CREATE TABLE Table name (
ID int unsigned NOT NULL Auto_increment primary key,
Field column type NOT null default ' ',
......
Field column type NOT null default ' '
) engine MyISAM charset UTF8;
2. Modify the table
Add Columns:
ALTER TABLE table name add column Name column type column parameter; Add columns to the last face of a table
ALTER TABLE table name add column Name column type column parameter first; Add columns to the front of the table
ALTER TABLE table name add column Name column type column parameter after a column name; Add a column after the specified column
To delete a column:
ALTER TABLE name drop column name;
To modify a column:
ALTER TABLE table name modify column name new column type new column parameter; Column name cannot be changed
ALTER TABLE name change old column name new column name new column type new column parameter;
@zhnoah
Source: http://www.cnblogs.com/zhnoah/
This article is owned by me and the blog Park, Welcome to reprint, but without the consent of the author must retain this paragraph, and in the article page obvious location to the original
The right to pursue legal liability.
MySQL learning note--3. Table