Beruflich Dokumente
Kultur Dokumente
BASICS
Whether you are selecting or querying data there are a minimum of 3 elements you will need; a field, an, operator
and a value
When you use this dialog, you are actually creating a SQL query. The syntax of the query differs depending on the
data source you are querying. The expression is sent to the data source and interpreted there rather than being
parsed in the dialog, so expressions are in the native format for the database at which they are aimed.
The following is the full list of query operators supported by file geodatabases, shapefiles,
coverages, and other file-based data sources. They are also supported by personal and ArcSDE
geodatabases, although these data sources may require different syntax. In addition to the
operators below, personal and ArcSDE geodatabases support additional capabilities. Please see
your DBMS documentation for details.
Arithmetic operators
You use an arithmetic operator to add, subtract, multiply, and divide numeric values.
Operator Description
* Arithmetic operator for multiplication
/ Arithmetic operator for division
+ Arithmetic operator for addition
- Arithmetic operator for subtraction
Arithmetic operators
Comparison operators
Operator Description
Less than. It can be used with strings (comparison is based on alphabetical
<
order), numbers, and dates.
Less than or equal to. It can be used with strings (comparison is based on
<=
alphabetical order), numbers, and dates.
Not equal to. It can be used with strings (comparison is based on alphabetical
<>
order), numbers, and dates.
Greater than. It can be used with strings (comparison is based on alphabetical
>
order), numbers, and dates.
Greater than or equal to. It can be used with strings (comparison is based on
alphabetical order), numbers, and dates. For example, this query selects all
>= the cities with names starting with the letters M to Z:
"POPULATION" IS NULL
Use the LIKE operator (instead of the = operator) with wildcards to build a
partial string search. For example, this expression selects Mississippi and
Missouri among USA state names:
Logical operators
Operator Description
Combines two conditions together and selects a record if both conditions are true.
For example, the following expression selects any house with more than 1,500 square
AND feet and a garage for more than two cars:
Field names
The Field list in this dialog automatically lists fields with the appropriate delimiters for the type of data you are
querying:
- If you are querying data in a file geodatabase, shapefile, dBase table, coverage, INFO table, then field names
are enclosed in double quotes:
"AREA"
- If you are querying data in a personal geodatabase then field names are enclosed in square brackets:
[AREA]
- If you are querying data in an ArcSDE geodatabase (i.e., data accessed via a database connection to an ArcSDE
Enterprise geodatabase, or data accessed from a database server running ArcSDE Personal Edition or Workgroup
Edition) or an ArcIMS image service or feature service, then fields are not enclosed:
AREA
- If you are querying data in a worksheet in an Excel file (.xls file) or a text file (.txt file), fields are delimited in
single quotes 'AREA' unless you are working in the Select By Attributes dialog launched from the table window,
in which case square brackets [AREA] are used.
Strings
Strings must always be enclosed within single quotes. For example:
"STATE_NAME" = 'California'
Strings in expressions are case sensitive, except when you are querying personal geodatabase feature classes and
tables. To make a case insensitive search in other data formats, you can use a SQL function to convert all values to
the same case. For file-based data sources, use either the UPPER or LOWER function.
For example, the following expression will select customers whose last name is stored as either Jones or JONES:
UPPER("LAST_NAME") = 'JONES'
Other data sources have similar functions. Personal geodatabases, for example, have functions named UCASE and
LCASE that perform the same function.
Use the LIKE operator (instead of the = operator) to build a partial string search. For example, this expression
would select Mississippi and Missouri among the USA state names:
"STATE_NAME" LIKE 'Miss%'
You can use greater than (>), less than (<), greater than or equal (>=), less than or equal (<=) and BETWEEN
operators to select string values based on sorting order. For example, this expression will select all the cities in a
coverage with names starting with the letters M to Z:
"CITY_NAME" >= 'M'
The not equal (<>) operator can also be used when querying strings.
Wildcard Characters
A wildcard character is a special symbol that stands for one or more characters.
For any file-based data, '%' means that anything is acceptable in its place: one character, a hundred characters, or
no character. Alternatively, if you want to search with a wildcard that represents one character, use '_'.
For example, this expression would select any name starting with the letters Cath, such as Cathy, Catherine, and
Catherine Smith:
"NAME" LIKE 'Cath%'
But this expression would find Catherine Smith and Katherine Smith:
"OWNER_NAME" LIKE '_atherine smith'
The wildcards you use to query personal geodatabases are '*' for any number of characters and '?' for one
character.
Wildcard characters appear as buttons on the query dialog. You can click the button to enter the wildcard into the
expression youre building. Only the wildcard characters that are appropriate to the data source of the layer or
table you are querying are displayed.
If you use a wildcard character in a string with the = operator, the character is treated as part of the string, not as a
wildcard.
With a joined table, use wildcards appropriate for the side of the join that you are querying. If the query only
applies to fields in the target table (the left-side table), use the target table wildcards. If the query only applies to
fields in the join table (the right-side table), use the join table wildcards. If the query involves fields from both sides
of the join, use the '%' and '_' wildcards.
For example, if you join a dbf file (the join table) to a personal GDB feature class (the target table):
1) Use * for queries that only involve personal GDB fields.
2) Use % for queries that only involve dbf columns.
3) Use % for queries involving columns from both sides of the table.
Querying numbers
You can query numbers using the equal (=), not equal (<>), greater than (>), less than (<), greater than or equal
(>=), and less than or equal (<=) operators.
"POPULATION96" >= 5000
The point is always used as the decimal delimiter regardless of your regional settings. The comma cannot be used
as a decimal or thousands delimiter in a query.
Calculations
Calculations can be included in queries using these arithmetic operators: + - * /
Calculations can be between fields and numbers.
For example:
"AREA" >= "PERIMETER" * 100
Calculations can also be performed between fields.
For example, to find the countries with a population density of less than or equal to 25 people per square mile, you
could use this expression:
"POP1990" / "AREA" <= 25
Note: calculations between fields in a coverage or shapefile (or an INFO table or a dBASE table) are not supported.
Operator precedence
Expressions evaluate according to standard operator precedence rules. For example, the part of an expression
enclosed in parentheses is evaluated before the part that isnt enclosed.
This example:
HOUSEHOLDS > MALES * POP90_SQMI + AREA
evaluates differently from:
HOUSEHOLDS > MALES * (POP90_SQMI + AREA)
You can either click to add parentheses and then enter the expression you want to enclose, or highlight the
existing expression that you want to enclose and then press the Parentheses button to enclose it.
Combining expressions
Expressions can be combined together with the AND and OR operators.
AREA > 1500 AND GARAGE > 3
When you use the OR operator, at least one expression of the two expressions separated by the OR operator must
be true for the record to be selected.
RAINFALL < 20 OR SLOPE > 35
Use the NOT operator at the beginning of an expression to find features or records that don't match the specified
expression. NOT expressions can be combined with AND and OR.
SUB_REGION = 'New England' AND NOT STATE_NAME = 'Maine'
Querying dates
The syntax required for querying dates depends on the data type. ArcMap will automatically write the proper
syntax for you when you double-click a date value in the Unique Values list. See the SQL reference mentioned
above for more about querying dates.
Open up the attribute table and right click on any column. Access to a few tools is possible including summarize
and statistics.
Summarizing data creates a simple summary table that can be added to your map.
VRI
Background Information
The Forest Resources Commission recommended a review of the provincial resource inventory process in its report
The Future of our Forests. The Resources Inventory Standards Committee (RISC) was established with the objective
of achieving common standards and procedures.
The Vegetation Resources Inventory is a photo-based, two-phased vegetation inventory program consisting of:
Within the ground sampling phase, Net Volume Adjustment Factor (NVAF) sampling is a mandatory component
that is integral in the calculation of inventory adjustment factors.
The Ministry of Forests and Range and forest licensees, is implementing the components of the Vegetation
Resources Inventory.
10. How many polygons Have a [SPECIES_CD_1] the is PLI and [SPECIES_PCT_1] = 60 and a [SPECIES_CD_2]
of SW [SPECIES_PCT_2] less than or equal to 30
11. What is the area in hectares of the following polygon whose map_id is 093G098 and poly_id is 1328?
12. Add a field called OPENING_ID (TEXT, 25). Populate the field with the values from MAPSHEET and
Polygon_id, separated by a hyphen (-) i.e 93G098-102
14. Remove all queries from your data. Go to the data view and symbolize the data on [SPECIES_CD_1]. Add
the VRI_Species1.lyr
15. Add the data again and this time add the following layer file Level5.lyr
a. What is the size of the large lake (Tabor Lake) in the south portion of the data.
b. Print a map with a scale bar and north arrow that shows the area of Tabor Lake in hectares