First, the operation of the table
1. View all Tables
Show tables;
2. Create a table
CREATE TABLE table name (field 1 type 1 constraint 1, field 2 type 2 constraint 2);
3, modify the name of the table
Rename table name to the new name;
4. Delete a table
drop table name;
Second, the operation of the field
1. Query fields (table structure)
Desc table name;
2. Add Field
ALTER TABLE name add field name type constraint;
3. Modify Fields
ALTER TABLE name change field name new field name type constraint
4. Delete fields
ALTER TABLE table name drop field name
5. Delete primary key
You need to change the primary key ID to a normal ID to not grow automatically, and then delete the primary key
ALTER TABLE students change ID idint;
ALTER TABLE students drop PRIMARY key;
ALTER TABLE students change ID idint auto_increment primary key notnull;
MySQL database command-line operations-operations on tables and fields