MySQL learning note--3. Table

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.