The following table, for example with student
- View table structure
desc student;
- add a field
alter table student add (field names) Age (data type) int unsigned (constraint) Not null default 0;
ALTER the Add Table Student Birthday datetime; --birthday datetime data type field names, constraints
- Change the field data types, constraints
alter table student modify (field names) Birthday (constraint) DATE;
- change the field name
--alter table student change (formerly) Birthday (rename) Birth (data types, constraints) datetime default "0-0-0-0";
ALTER Change Table Student Birth datetime default Birthday "0-0 -0-0 ";
- Delete field (caution)
the ALTER drop the Table Student Age;