This is a draft cheat sheet. It is a work in progress and is not finished yet.
Categories
DDL: Data Definition Language |
DQL: Data Query Language |
DML: Data Manipulation Language |
DCL: Data Control Language |
TCL: Transaction Control Language |
Commands
DDL CREATE | DROP | ALTER | TRUNCATE | RENAME | COMMENT
|
DQL SELECT
|
DML INSERT | UPDATE | DELETE | LOCK | CALL | EXPLAIN PLA
|
DCL GRANT | REVOKE
|
TCL COMMIT | ROLLBACK | SAVEPOINT | SET TRANSACTION
|
|
|
|
|
Execution Order
1. FROM, JOIN |
2. WHERE |
3. GROUP BY |
4. AGGREGATE FUNCTIONS |
5. HAVING |
6. WINDOW FUNCTIONS |
7. SELECT |
8. DISTINCT |
9. UNION/INTERSECT/EXCEPT |
10. ORDER BY |
11. OFFSET |
12. LIMIT/FETCH/TOP |
Window functions can be used in SELECT and ORDER BY, however they cant be put anywhere in the FROM, WHERE, GROUP BY, or HAVING clauses.
Operators
Arithmetic |
+ - * / % |
Bitwise |
& | ^ |
Comparison |
= < > <= >= !< !> <> != |
Compound |
+= -= *= /= %= &= |= ^= |
Logical |
AND | OR | NOT | ANY | SME | ALL | BETWEEN| IN | EXISTS | LIKE | IS NULL | UNIQUE |
|