Basic MySql operation statement sorting
DATABASE:
Create CREATTE {DATABASE | SCHEMA} [if not exists] db_name [DEFAULT] character set [=] charset_name; Delete: DROP {DATABASE | SCHEMA} [if exists] db_name; display: SHOW {DATABASES | SCHEMAS} [LIKE 'pattern' | WHERE expr]; select: USE database_name;TABLE:
CREATE: create table [if not exists] table_name (column_name data_type ,...) // delete the names of each column in the database in (): drop table [if exists] table_name; display: show tables [FROM db_name] [LIKE 'pattern' | EHERE expr];
COLUMN:
ADD: alter table tbl_name ADD [COLUMN] col_name column_definition [FIRST | AFTER col_name] // add first to the frontend, AFTER col_name, behind col_name. If this item is omitted, it is added to the end; delete: alter table tbl_name DROP [COLUMN] col_name;
Record ROW:
Add: INSERT [INTO] tbl_name [(col_name,...)] VALUES (val ,..) DELETE: delete from tbl_name [WHERE where_condition] Modify/update: UPDATA [LOW_PRIORITY] [IGNORE] table_reference SET col_name1 = {expr1 | DEFAULT }[, col_name2 = {expr2 | DEFAULT}]... [WHERE where_condition] example: UPDATE users SET age = 18 WHERE age = 17; display: SELECT expr ,... FROM tal_name; SELECT * FROM tal_name; // view all queries: SELECT select_expr [, select_expr...] [FROM table_references [WHERE where_condition] [group by {col_name | position} [ASC | DESC],...] [HAVING where_condition] [order by {col_name | expr | position} [ASC | DESC],...] [LIMIT {[offset,] row_count | row_count OFFSET}] // example: SELECT name FROM users WHERE id = 3;Others:
Constraints:Not null; primary key; unique key; DEFAULT; FOREIGN KEY
Other common keywords: AUTO_INCREMENT