The following is a list of MySQL statements and clauses in alphabetical order. Each statement is given with its syntax and an explanation. Optional clauses and flags are shown in square brackets. Particular components, such as a database or table name, are shown in italic. The vertical bar is used to separate alternative choices and is not part of the statement syntax.
Some statements have alternative structures to their syntax. Those alternatives are usually shown in complete form. The curly braces indicate that one of the choices is required. Examples are provided to show how a statement and the various clauses may be used for almost all statements. The examples involve a fictitious database for a computer consulting firm that maintains work requests for computer maintenance. Some examples involve a fictitious database of a vendor.
To save space, almost all of the examples are shown without their results. To be able to focus on the particulars of the statements and clauses, the statements are fairly straightforward and do not make much use of the many built-in functions available with MySQL. Explanations of any functions used, though, can be found in other chapters.