Queries or where clauses are used in ArcGIS to select a subset of records. All query expressions use Structured Query Language (SQL) to formulate these search specifications. You will need to use SQL when you construct an expression for many geoprocessing tools, including:
You can enter queries in Clause mode, using buttons and choicelists to construct the query in easy-to-understand language. Or, if you are experienced with SQL, you can enter the where clause as text directly in SQL mode.
Learn more about building SQL queries
Clause mode
To build a query in Clause mode perform the following steps:
- Click Add Clause.
- Select a field from the choicelist of fields available in your data.
- Select an operator from the choicelist, such as Is Equal To or Is Greater Than. Valid options are displayed depending on the field type that you selected.
- Select from the choicelist or enter a value or field to evaluate against.
- Press the Add button to commit the clause.
You can add multiple clauses and choose if the clauses should be combined with exclusive (And) or additive (Or) logic. You can group or indent clauses together to build complex expressions.
SQL mode
SQL mode provides a powerful SQL code editor with syntax help and autocompletion. If you are familiar with SQL expressions you can build a query quickly and include any operators or logic supported in SQL. Use the Verify button to make sure the expression you have written is valid.