background image
<< Derby limitations | Rules for SQL92 identifiers >>

SQL language reference

<< Derby limitations | Rules for SQL92 identifiers >>
Derby Reference Manual
17
SQL language reference
Derby implements an SQL-92 core subset, as well as some SQL-99 features.
This section provides an overview of the current SQL language by describing the
statements, built-in functions, data types, expressions, and special characters it contains.
Capitalization and special characters
Using the classes and methods of JDBC, you submit SQL statements to Derby as
strings. The character set permitted for strings containing SQL statements is Unicode.
Within these strings, the following rules apply:
· Double quotation marks delimit special identifiers referred to in SQL-92 as delimited
identifiers.
· Single quotation marks delimit character strings.
· Within a character string, to represent a single quotation mark or apostrophe, use
two single quotation marks. (In other words, a single quotation mark is the escape
character for a single quotation mark.)
A double quotation mark does not need an escape character. To represent a double
quotation mark, simply use a double quotation mark. However, note that in a Java
program, a double quotation mark requires the backslash escape character.
Example:
-- a single quotation mark is the escape character
-- for a single quotation mark
VALUES 'Joe''s umbrella'
-- in ij, you don't need to escape the double quotation marks
VALUES 'He said, "hello!"'
n = stmt.executeUpdate(
"UPDATE aTable setStringcol = 'He said, \"hello!\"'");
· SQL keywords are case-insensitive. For example, you can type the keyword
SELECT as SELECT, Select, select, or sELECT.
· SQL-92-style identifiers are case-insensitive (see
SQL92Identifier
), unless they are
delimited.
· Java-style identifiers are always case-sensitive.
· * is a wildcard within a
SelectExpression
. See
The * wildcard
. It can also be the
multiplication operator. In all other cases, it is a syntactical metasymbol that flags
items you can repeat 0 or more times.
· % and _ are character wildcards when used within character strings following a
LIKE operator (except when escaped with an escape character). See
Boolean
expressions
.
· Comments can be either single- or multiline as per the SQL-92 standard. Singleline
comments start with two dashes (--) and end with the newline character. Multiline
comments are bracketed and start with forward slash star (/*), and end with star
forward slash (*/). Note that bracketed comments may be nested. Any text between
the starting and ending comment character sequence is ignored.
SQL identifiers
An identifier is the representation within the language of items created by the user, as
opposed to language keywords or commands. Some identifiers stand for dictionary
objects
, which are the objects you create- such as tables, views, indexes, columns, and