First, create a data table
Syntax:CREATE TABLE table name (Field field type [Field Properties], Field field type [Field Properties],...) [Table options];
Table options: Data table properties, typically including engine, CharSet, collate
Engine: Storage engine, the way MySQL provides specific storage data, by default is InnoDB (before the 5.5 version is MyISAM)
CharSet: Character set, valid only for current data table (level is higher than database)
Collate: Proofing Set
Extension: Create a data table by copying an existing table structure, copy only the structure, and the data in the table is not copied
Syntax:CREATE table A new table name like already has a list name;
PS: The existing table name can be the current database, or it can come from another database (accessed through the "Database name. Table Name" method)
Second, view the data sheet
2.1 View All data sheets
Syntax:show tables;
2.2 Viewing some data sheets
Syntax:show tables like "match pattern";
2.3 Viewing the data table structure
Syntax:desc table name, or Show columns from table name;
Third, modify the data table
3.1 Modifying table names
Syntax: Rename table name tonew table name;
3.2 Modifying data table options
Syntax:ALTER TABLE table name new tables option;
Note: If data is already in the table, modify the table options carefully!
3.3 Modifying the data table structure
New field syntax:ALTER TABLE name add field Name field type [fields Properties] [position];
PS: If you do not specify a location, the default is placed after the last field
Modify field syntax: ALTER TABLE name change old field name new field name new fieldType [New field property] [new position];
Note: If you just want to modify the field name simply, you can only modify the field name, the field type can be used originally, but not empty!
Modify field type and attribute syntax:ALTER TABLE table name modify field name new field type [new Field property] [new location];
Delete field syntax:ALTER TABLE name drop field name;
Iv. Deleting Data sheets
Syntax:drop table name;
MySQL Data sheet basic operations