mysql-Adding a Delete field

Source: Internet
Author: User

To add a field:

--Add Field--ALTER TABLE tb_name ADD field Name field type [integrity constraint] [first| After]--Add a card field to User10ALTER TABLEUser10ADDCardCHAR( -);--with integrity constraints.ALTER TABLEUser10ADDTest1VARCHAR( -) not NULL UNIQUE;--Add a field to the first bitALTER TABLEUser10ADDTest2VARCHAR(Ten) not NULLFirst ;--Add a field to a specified locationALTER TABLEUser10AddTest3INT  not NULLDefautl -After username;--batch Add, select once, add multiple timesALTER TABLEUser10ADDTest4INT  not NULL DEFAULT 123After password,ADDTest5FLOAT(6,2) Frist,ADDTest6SET('A','B','C','D');

To delete a field:

--Delete test6 field--ALTER table name DROP field nameALTER TABLEUser10DROPTest6;ALTER TABLEUser10DROPtest1;--Select a table at a time to delete multiple fieldsALTER TABLEUser10DROPTest2,DROPTest3,DROPTest4,DROPTEST5;

To complete the add delete operation at one time:

-- once selected, multiple actions -- Add Test field, delete addr field ALTER TABLE User10 ADD INT  not NULL DEFAULT Ten After sex, DROP addr;

mysql-Adding a Delete field

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.