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;
Data Tables Table:
Create:
CREATE TABLE [IF not EXISTS] table_name (column_name data_type, ...)//() the name of each column within the library
Delete:
DROP TABLE [IF EXISTS] table_name;
Display:
SHOW TABLES [from db_name] [like ' Pattern ' | | Ehere expr];
Columns Column:
Join:
ALTER TABLE tbl_name ADD [COLUMN] col_name column_definition [first| After Col_name]
First joins to the front end, after Col_name, followed by col_name, omitting the item, then adding it to the last face.
Delete:
ALTER TABLE tbl_name DROP [COLUMN] col_name;
record ROW:
Join:
INSERT [Into]tbl_name [(Col_name,...)] VALUES (Val,..)
Delete:
DELETE from Tbl_name [WHERE where_condition]
Changes/updates:
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
Enquiry:
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}]
]
For example: SELECT name from users WHERE id=3;
Other:
constraint conditions:Not NULL; PRIMARY KEY; UNIQUE KEY; DEFAULT; FOREIGN KEY
other frequently used keyword: auto_increment
MYSQL Basic Operation Statement collation