Create a data table
CREATE TABLE table names (column names an attribute, second attribute column names ...);
View table structure
SHOW [FULL] COLUMNS FROM database name [FROM database name];
Use DESCRIBE ranked database name;
Modify table structure
ALTER [INGNORE] TABLE database name alter_spec [, alter_spec] ... | table_options
Add new fields and modify field definitions
ALTER TABLE td_admin ADD email varchar(50) not null,modify user varchar(40);
Modify field name
ALTER TABLE db_admin.tb_usernew1 CHANGE COLUMN user username VARCHAR(30) NULL DEFAULT NULL;
Delete field
ALTER TABLE tb_admin DROP email;
Modify the table name
ALTER TABLE tb_usernew1 RENAME AS tb_userOld;
Rename Table
RENAME TABLE tb_admin TO tb_user;
Copy the table
CREATE TABLE [IF NOT EXISTS] Table Name
{LIKE Data Source Table Name | (the LIKE source data table name)}
When you copy a table, at the same time you want to copy its contents:
CREATE TABLE tb_userNew1
AS SELECT * FROM tb_user;
Delete table
DROP TABLE [IF EXISTS] data table;