Classification of SQL
- DDL (Data Definition Language) includes CREATE, DROP, ALTER, RENAME, TRUNCATE and other keywords used to create, delete, and modify the structure of databases and data tables.
- DML (Data Manipulation Language) includes INSERT, DELETE, UPDATE, SELECT and other keywords used to add, delete, update, query (sometimes independent as DQL) database records.
- DCL (Data Contril Language) includes GRANT, REVOKE, COMMIT, ROLLBACK, SAVEPOINT and other keywords used to define security levels and access rights.
Rules and Specifications of SQL
basic rules
- SQL can be written in one line or multiple lines. For readability, it is recommended to write clauses in separate lines and introduce necessary indentation.
- Every SQL statement ends with an English semicolon ';' or \g, \G.
- Keywords cannot be abbreviated and cannot be divided into lines
- Single quotes can be used for string and date data, and double quotes should be used for other column names. It is not recommended to omit as.
case specification
- Database name, table name, table alias, variable name, field alias are all lowercase
- SQL keywords, function names, and bind variables are capitalized
Annotation Specification
- MySQL-specific single-line comment method: #Comment text
- Single-line comment method: -- comment text -- remember two -- there must be a space after
- Multi-line comment method: / comment text /
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。