See if the data table exists: show TABLES;
Displays the database that has been opened: SELECT databases ();
View data table structure: Show COLUMNS from * * * (data table name);
Insert data: Insert * * * (data table name) (,) VALUES (data);
Record Lookup: SELECT * FROM * * * (data table name)
Display data table information: Show CREATE Table * * * (data table name)
Display index: Show INDEXES from ***\g (data table name
Creating databases: Create Database
modifying databases: ALTER database
Delete database: Drop db
Open database: Use * * * (database name)
See if the database exists: show DATABASES;
Delete Column: ALTER TABLE tb1_name Drop[column] col_name;
Add multiple columns: ALTER TABLE tb1_name Add[column] (col_name column_definition,...);
Add single column: ALTER TABLE tb!_name Add[column] col_name column_definition [first| After Col_name];
Delete Record: Delete from province WHERE id=3;
Add PRIMARY KEY constraint: ALTER TABLE users2 add PRIMARY key (ID);
Add FOREIGN KEY constraint: ALTER TABLE users2 add FOREIGN KEY (PID) REFERENCES provinces (ID);
Add a DEFAULT constraint: Alter TABLE users2 alter age SET to default 15;
Delete default constraint: Alter TABLE users2 alter age DROP defaults;
Add UNIQUE constraint: ALTER TABLE table_name Add [CONSTRAINT [symbol]] unique [INDEX | KEY] [index_name] [Index_type] (index_col_name, ...)
Delete PRIMARY KEY constraint: ALTER TABLE tbl_name DROP PRIMARY key
Delete Unique constraint: ALTER TABLE tbl_name DROP {index| KEY} index_name
Delete foreign KEY constraint: ALTER TABLE tbl_name DROP FOREIGN KEY fk_symbol
Data table modification: Nothing but add columns, delete columns, add constraints, delete constraints. An alter is used, and insert is used to add an insert record to a data table.
Modify Column definition: ALTER TABLE tbl_name MODIFY [column] Col_name column_definition [first| After Col_name]
Modify Column Name: ALTER TABLE tbl_name Change [column] Old_col_name new_col_name column_definition [first| After Col_name
Method 1:alter TABLE tbl_name RENAME [To|as] New_tbl_name
Method 2:rename TABLE Tbl_name to New_tbl_name [, tbl_name2 to New_tbl_name] ...
Common statement code blocks in MySQL list