SQL Expressions in ArcMap
-
Upload
mohamedalamin -
Category
Documents
-
view
226 -
download
0
Transcript of SQL Expressions in ArcMap
-
7/26/2019 SQL Expressions in ArcMap
1/4
SQL Expressions in ArcMap
Building an SQL expression
Structured Query Language (SQL) is a powerful language you use to define one or more criteria that
can consist of attributes operators and calculations! "or example imagine you ha#e a map of
customers and want to find those who spent more than $%&&&& with you last year and whose business
type is 'estaurant'! ou would select the customers with this expression* Sales + %&&&& A,-
Business.type / 0estaurant.'
1n ArcMap you can select features by searching with a Structured Query Language (SQL) expression!
2hen you create an expression in the Select By Attributes dialog box you create it in a #ersion of SQL3
the one you use depends on the format of the data you0re 4uerying! ou use A,S1 SQL with shared
geodatabase data and 5et SQL with personal geodatabase data! 6hese two #ersions of SQL are similar3
howe#er each supports features and functions the other doesn0t.
2hen you 4uery co#erages shapefiles 1,"7 tables and dBASE tables you use a limited #ersion of
SQL that doesn0t support functions or the many features of A,S1 and 5et SQL! 6he following sectionsshow you how to build simple expressions! "or information on how to build more complex expressions
see your SQL reference manual.
Some special rules apply when building a SQL expression for 8oined layers and tables! "or more
information see the 9nowledge Base article :ow to properly format an SQL expression to ma;e
selections in 8oined layers and tables.
Specifying fields
1f you0re 4uerying Arc1nfo co#erages shapefiles 1,"7 tables or dBASE tables enclose fields in double
4uotes:
"AEA"
1f you0re 4uerying personal geodatabase data enclose fields in s4uare brac;ets:
-
7/26/2019 SQL Expressions in ArcMap
2/4
]AEA[
1f you0re 4uerying shared geodatabase data don0t enclose fields:
AEA
Searching for strings
egardless of the data you0re 4uerying always enclose strings such as names in single 4uotes! "or
example this 4uery will select
-
7/26/2019 SQL Expressions in ArcMap
3/4
S6A6E.,AME L19E 0Miss'%
6his 4uery will find
-
7/26/2019 SQL Expressions in ArcMap
4/4
Building expressions with more than one criteria
6o search for se#eral strings or #alues in a field use the 1, operator! "or example this expression will
search for four different state names in a shared geodatabase:
S6A6E.,AME 1, (0Alabama0 0Alas;a0 0