Chapter 4. SQL Statements

This chapter provides brief but comprehensive explanations of the clauses, flags, and options in MySQL’s extensive implementation of SQL. While this chapter covers some new material in Version 5.0 of MySQL, some features are left out, because they were not firm at the time of this writing.

This chapter starts with a list of statements grouped by type, as a quick reference. Following this, the statements are listed in alphabetical order. For the more complex statements, to simplify their presentation, the syntax is broken into several sections according to the different uses of the statement.

Some general elements of MySQL’s SQL syntax include the following:

  • SQL statements may span multiple lines, but must end with either a semi-colon or \G.

  • When values are enclosed in parentheses, multiple values usually can be specified, separated by commas.

  • Strings and dates must be specified within single or double quotes.

  • Elements of a statement’s syntax are case-insensitive. However, on Unix-type systems, database and table names, as well as filenames, are case-sensitive.

Get MySQL in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.