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.
Statements Grouped by Type
The following is a quick list of SQL statements grouped by type. Some statements are listed in more than one group, because they have more than one use relative to the groups listed.
Data Manipulation
DELETE, DO,
HANDLER, INSERT,
JOIN, LOADDATAINFILE,
REPLACE, SELECT,
SELECT...UNION, TRUNCATE,
UPDATE, USE
Database and Table Schema
ALTERDATABASE,
ALTERTABLE,
ALTERVIEW,
CREATEDATABASE ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access