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 Clause mode to construct a query in easy-to-understand language. Or, if you are experienced with SQL, enter the WHERE clause as text using SQL mode.

Learn more about query expressions

Build a query in Clause mode

To build a query in 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.


  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 SQL 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 SQL mode, complete the following steps:

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