input consists of a sequence of commands. A command
is composed of a sequence of tokens
, terminated by a semicolon (;). The end of the input stream also terminates a command. Which tokens are valid depends on the syntax of the particular command.
A token can be a key word
, an identifier
, a quoted identifier
, a literal
), or a special character symbol. Tokens are normally separated by whitespace
(space, tab, new line), but need not be if there is no ambiguity (which is generally only the case if a special character is adjacent to some other token type).
can occur in SQL
input. They are not tokens - they are effectively equivalent to whitespace.
syntax is not very consistent regarding what tokens identify commands and which are operands or parameters. The first few tokens are generally the command name, so in the above example we would usually speak of a SELECT
, an UPDATE
, and an INSERT
command. But for instance the UPDATE
command always requires a SET
token to appear in a certain position, and this particular variation of INSERT
also requires a VALUES
token in order to be complete. The precise syntax rules for each command are described in Section 2.3