The Add Query Criteria dialog box enables you to refine your SQL query by creating or adding query criteria to the WHERE clause of the SQL statement. A query criterion contains the column on which to define the criterion, a comparison operator, and a value or parameter. After you create a criterion, it appears in the WHERE clause in the SQL pane.
To open this dialog box, select a column in the grid pane of the Visual SQL Editor, right-click and choose Add Query Criteria.
This dialog box has the following fields and tabs:
=
equal, <
less than, <=
less than or equal to, >
greater than, >=
greater than or equal to, and <>
not equal.IN
: Use the IN
operator to match one or more specific values. For example, type ('Smith', 'Jones')
to retrieve columns that contain the names Smith or Jones. LIKE
: Use the LIKE
operator to search for patterns. Enclose the patterns in single quotes. You can use the %
sign as a wildcard both before and after the pattern. For example, type 'S%'
to search for values beginning with the letter S, such as Smith, or '%th%'
to find all values that contain the letters th, such as Smith or Cathay.8
for a numeric field or 'Smith'
for a text field. To create a parameter, first specify the parameter in the Add Query Criteria dialog box. Then add a line to your Java class in the Java Editor to use the parameter. The following example passes the string 'Smith'
as parameter 1 when the query is executed:
myRowSet.setObject(1, 'Smith');