Use queries or WHERE clause parameters in geoprocessing tools to select a subset of records. Query expressions use Structured Query Language (SQL) to formulate search specifications. You will need to use SQL when you construct an expression for many geoprocessing tools, including the following:
Enter queries in designer (clause) mode to construct a query with drop-down menus. Or, if you are experienced with SQL, enter the WHERE clause as text in editor mode.
Learn more about query expressions
Build a query in designer mode
To build a query in designer (clause) mode, perform the following steps:
- Select a field from the Select a field drop-down menu.
Additional drop-down menus for operators and values appear.
- From the second drop-down menu, select an operator, such as is equal to or is less than.
Valid operators display depending on the selected field.
- From the third drop-down menu, enter or select a value or field to evaluate against.
- Click the Verify button
to validate the expression.
- Optionally, click the Add Clause button
to add additional clauses and select if the clauses should be combined with exclusive (And) or additive (Or) logic.
- Optionally, click the Group Clauses button
or the Ungroup Clauses button
to group or ungroup clauses to build complex expressions.
Build a query in editor mode
If you are familiar with SQL expressions, you can build a query quickly and include any operators or logic supported in SQL. To build a query in editor mode, complete the following steps:
- Click the SQL Editor toggle button to enable a SQL code editor with syntax help and autocomplete.
- Use the SQL code editor to build the query.
- Click the Verify button
to validate the expression.