
To query personal geodatabases, you use the Microsoft Access syntax. To query file-based data, including file geodatabases, coverages, shapefiles, INFO tables, dBASE tables, and CAD and VPF data, you use the ArcGIS SQL dialect that supports a subset of SQL capabilities. The SQL syntax you use differs depending on the data source. This would select the features containing "Alabama" in a field named STATE_NAME. A basic SQL WHERE clause would look like STATE_NAME = 'Alabama' The next part of the expression is the WHERE clause, which is the part you must build. In most ArcGIS dialog boxes where you build a query expression, the name of the layer or table is supplied for you (or you select it from a drop-down list).

See SQL reference for query expressions used in ArcGIS for information on subqueries. For this reason, keywords, such as DISTINCT, ORDER BY, and GROUP BY, cannot be used in an SQL query in ArcGIS except when using subqueries. Optionally, parentheses () can be used for defining the order of operations in compound queries.īecause you are selecting columns as a whole, you cannot restrict the SELECT to return only some of the columns in the corresponding table because the SELECT * syntax is hard-coded. Here is the general form for ArcGIS query expressions:įor compound queries, the following form is used: Query expressions use the general form that follows a Select * From Where clause (for example, the part of the SQL expression that comes after SELECT * FROM WHERE). SELECT * FROM forms the first part of the SQL expression and is automatically supplied for you. For a more detailed reference, see SQL reference for query expressions used in ArcGIS.
#Devonthink pro and sql query how to#
This topic describes how to build basic WHERE clause expressions and is useful if you are just getting started with SQL. For example, you use this syntax using the Select By Attributes tool or with the Query Builder dialog box to set a layer definition query.

Query expressions in ArcGIS adhere to standard SQL expressions. Query expressions are used in ArcGIS to select a subset of features and table records.
