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