MySQL alter statement usage summary _ MySQL

Source: Internet
Author: User
MySQL alter statement usage summary bitsCN.com
MySQL alter statement usage summary 1: Delete a column alter table name DROP column name 2: add alter table name ADD column name int not null comment 3: modify the column type information alter table name CHANGE column name new column name (this can be the same as the original column name) bigint not null comment '4: rename the alter table column [TABLE name] CHANGE [column name] [New column name] bigint not null comment 'annotation description '5: rename alter table rename New TABLE name 6: delete TABLE primary key Alter TABLE name drop primary key7: add primary key alter table sj_resource_charges add CONSTRAINT PK_SJ_RESOURCE_CHARGES primary key (resid, resfromid) 8: ADD index alter table sj_resource_charges add index INDEX_NAME (name); 9: add the unique restricted condition index alter table sj_resource_charges add unique emp_name2 (cardnumber); 10: delete the index alter table tablename drop index emp_name; author three feet still bitsCN.com

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.