How to specify a WHERE condition

Previous Next

To specify a WHERE condition:

1.In the From List or Repository tab, click on the (first) column name used in the WHERE condition, then drag-and-drop it onto the Condition Tree pane (you can open this pane by switching it to On in the Show toolbar). The Define Condition dialog will appear.
If the Condition Tree pane is not empty, you can only drop the selected column onto one of the existing conditions.
If the WHERE clause does not use a column name (e.g., EXISTS clauses) you can call the Define Condition dialog without column name by choosing from the menu bar Conditions, Insert.
2.In the Define Condition dialog, compose the condition by double-clicking in the Columns, Functions or Operators lists and/or by manually typing in the text field. The SQL Definer automatically produces the WHERE keyword, so do not type it yourself.
If the WHERE clause contains a subquery, select function SUBQUERY(name) from the Functions list or type it (see step 5 for actually defining the subquery). The subquery name is optional. It will help you recognize it in the Query Tree but has no other function. The condition should now look like:

[columnoperator SUBQUERY([name])


3.For all but the first WHERE clause in a query, indicate whether the new condition must be AND-ed, OR-ed, NOT AND-ed, or NOT OR-ed to the existing clause selected in the Condition Tree pane. For this, you are presented with a radio group (the default is AND).
4.Click OK to dismiss the Define Condition dialog.
5.If you have just specified a subquery, you can now define it by selecting the Query Tree tab and clicking on the subquery, or double clicking on the condition with the subquery. Because most subqueries refer to the table in the main statement (correlated subquery), the SQL Definer places this table in the From List by default. You can now define the subquery as you would define a main query.