You can write queries to filter features and table records to create a subset that you can then select, identify, analyze, or draw. Queries are composed of one or more queries written in standard Structured Query Language (SQL) syntax. As an alternative to writing SQL syntax, you can optionally use the Clause mode of the query builder to interactively build queries from menu choices.
See the Definition query topic for specific instructions on building clauses for definition queries of a layer or table.
Construct a query in Clause mode
You construct a query by building one or more clauses. Follow these steps to construct a query in a query builder in a pane.
- In the query builder, if necessary, click Add Clause to access the menus to build a clause.
- Choose values from the drop-down menus to construct the Where clause. These menus, and their values, are specific to the underlying source data.
- Optionally click Verify the SQL expression is valid to verify and add the clause to the query.
- Optionally click Add Clause to add another clause to the query.
- Optionally click SQL to see the query written in native SQL syntax.
Load a query
Alternatively, you can load an existing query. Click Load to load a query from a query expression file (.exp file extension). If it is a complex expression that cannot be evaluated in Clause mode, the clause opens in SQL mode instead.
Modify an existing query
Once you've constructed a query from one or more clauses, there are a number of ways to modify the query. Follow any of these actions as necessary:
- The clauses in a query are always available for editing. Hover over a clause until it is highlighted. Click any of the menus of values that compose the clause and choose different values.
- To add a clause to the query, click Add Clause .
- To remove a clause from the query, hover over the clause until it is highlighted and click Remove Clause .
- To remove the query entirely, click Remove Query .
- To export the query syntax to a query expression file (.exp file extension), click Save . Browse to a file location and provide a file name.
- To replace the current query with a different query from a query expression file (.exp file extension), click Load . Browse to the file and click OK.