This topic discusses the conventions you must use when entering the following types of literal values for a search condition:
Note The information in this topic is derived from the rules for standard SQL-92. However, each database can implement SQL in its own way. Therefore, the guidelines provided here might not apply in every case. If you have questions about how to enter search values for a particular database, refer to the documentation for the database that you are using.
The following guidelines apply when you enter text values in search conditions:
'Smith'
If you are entering a search condition in the Grid pane, you can simply type the text value and the Query Designer will automatically put single quotation marks around it.
Note In some databases, terms in single quotation marks are interpreted as literal values, whereas terms in double quotation marks are interpreted as database objects such as column or table references. Therefore, even though the Query Designer can accept terms in double quotation marks, it might interpret them differently than you expect. For details about the use of quotation marks for database identifiers in Oracle, see Query Designer Considerations for Oracle Databases.
='Swann''s Way'
If you are unsure about whether the database uses a case-sensitive search, you can use the UPPER or LOWER functions in the search condition to convert the case of the search data, as illustrated in the following example:
WHERE UPPER(lname) = 'SMITH'
For details about the functions to convert to uppercase and lowercase letters, see Functions for Expressions.
The following guidelines apply when you enter numeric values in search conditions:
> 1.23456e-9
Note For details about entering currency values in SQL Server, see Query Designer Considerations for SQL Server Databases.
The format you use to enter dates depends on the database you are using and in what pane of the Query Designer you are entering the date. The Query Designer can work with the following date formats:
{ d '1990-12-31' }
{ ts '1990-12-31 00:00:00' }
In general, the ANSI standard date format is used with databases that represent dates using a true date data type. In contrast, the datetime format is used with databases that support a datetime data type.
Note For details about working with dates in Oracle, see Query Designer Considerations for Oracle Databases.
The following table summarizes the date format that you can use in different panes of the Query Results.
Pane | Date format |
Grid | Locale-specific Database-specific ANSI standard Dates entered in the Grid pane are converted to a database-compatible format in the SQL pane. |
SQL | Database-specific ANSI standard Dates entered into the SQL pane are converted to the locale-specific format in the Grid pane. |
Results | Locale-specific |
The format of logical data varies from database to database. Very frequently, a value of False is stored as zero (0). A value of True is most frequently stored as 1 and occasionally as -1. The following guidelines apply when you enter logical values in search conditions:
SELECT * FROM authors
WHERE contract = 0
SELECT * FROM authors
WHERE contract = 1
SELECT * FROM authors
WHERE contract <> 0