Build a query

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:

  1. Select a field from the Select a field drop-down menu.

    Additional drop-down menus for operators and values appear.

  2. 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.

  3. From the third drop-down menu, enter or select a value or field to evaluate against.

    Expression

  4. Click the Verify button Check mark to validate the expression.
  5. Optionally, click the Add Clause button Add to add additional clauses and select if the clauses should be combined with exclusive (And) or additive (Or) logic.
  6. Optionally, click the Group Clauses button Group Clauses or the Ungroup Clauses button Ungroup Clauses 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:

  1. Click the SQL Editor toggle button to enable a SQL code editor with syntax help and autocomplete.
  2. Use the SQL code editor to build the query.
  3. Click the Verify button Check mark to validate the expression.