1.1.2 Basic rules for writing a SELECT statement
The basic rules for writing a SELECT statement are as follows:
-
We recommend that table names and column names specified in the SELECT statement be enclosed in double quotation marks ("). Enclosing a table or column name in double quotation marks allows you to specify the same name as an SQL reserved word, and eliminates the need to rewrite the SQL statement if a reserved word with that same name is added in the future.
In addition, if a name is not enclosed in double quotation marks, any lowercase letters are treated as uppercase. For example, if you specify name, it is treated as NAME.
-
Enclose CHAR type and VARCHAR type character string data in single quotation marks (').
Example: WHERE "NAME"='Taro Tanaka'
-
For type DATE data, enter dates in the following manner.
Example 1: WHERE "PUR-DATE">=DATE'2011-09-06'
Example 2: WHERE "PUR-DATE">=DATE'2011/09/06'
The date format in Example 1 is used in the examples of SELECT statements given in this chapter.
-
INTEGER type numeric data is not enclosed in single quotation marks (').
Example: WHERE "PUR-NUM"=10