MySQL alter statement usage Summary

Source: Internet
Author: User


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 'www.2cto.com 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 restriction index alter table sj_resource_charges add unique emp_name2 (cardnumber); 10: Delete the index alter table tablename drop index emp_name; the author is still three feet away

Related Article

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.