Professional Documents
Culture Documents
Science
and
Management
|
Texas
A&M
University
ESSM
464:
Spa*al
Project
Management
(c)
2015,
A.
Michelle
Lawing
Today
In
Class
Announcements
Quiz
Lecture (sql)
Break
Lab
Ecosystem
Science
and
Management
|
Texas
A&M
University
ESSM
464:
Spa*al
Project
Management
(c)
2015,
A.
Michelle
Lawing
Announcements
Website
is
updated
ESSM
Recep*on
April
17th
6pm
hjp://essm.tamu.edu/
Ecosystem
Science
and
Management
|
Texas
A&M
University
ESSM
464:
Spa*al
Project
Management
(c)
2015,
A.
Michelle
Lawing
Footprints
5K
April
18th
hjp://essm.tamu.edu/footprints/
Ecosystem
Science
and
Management
|
Texas
A&M
University
ESSM
464:
Spa*al
Project
Management
(c)
2015,
A.
Michelle
Lawing
Quiz
Ecosystem
Science
and
Management
|
Texas
A&M
University
ESSM
464:
Spa*al
Project
Management
(c)
2015,
A.
Michelle
Lawing
SQL
standard
computer
language
for
accessing
and
managing
databases
SQL
expressions
are
used
in
many
parts
of
ArcGIS
dene
a
subset
of
data
on
which
to
perform
some
opera*on
You
use
it
in
ArcMap
to
select
features
with
the
Select
by
Ajributes
dialog
box
You
use
it
in
ArcMap
in
the
Query
Builder
dialog
box
to
set
a
layer
deni*on
query
Ecosystem
Science
and
Management
|
Texas
A&M
University
ESSM
464:
Spa*al
Project
Management
(c)
2015,
A.
Michelle
Lawing
SQL
You
use
it
in
geoprocessing
to
dene
a
subset
of
features
You
use
it
in
geoprocessing
to
dene
records
to
perform
an
opera*on
on
You
also
use
SQL
to
select
features
programma*cally
We
will
review
the
basic
WHERE
clause
expressions
For
the
SQL
beginner
Detailed
reference
here
(hjp://webhelp.esri.com/
arcgisdesktop/9.2/index.cfm?
TopicName=SQL_Reference)
Ecosystem
Science
and
Management
|
Texas
A&M
University
ESSM
464:
Spa*al
Project
Management
(c)
2015,
A.
Michelle
Lawing
SQL
Syntax
The
syntax
you
use
to
build
a
SQL
expression
diers
depending
on
the
data
source.
SQL
is
a
standard,
but
not
all
database
sogware
implements
the
same
dialect
of
SQL.
To
query
personal
geodatabases,
you
use
the
same
syntax
used
in
Microsog
Access.
To
query
an
ArcSDE
geodatabase,
you
use
the
SQL
syntax
of
the
underlying
database
management
system
(DBMS)either
Oracle,
SQL
Server,
DB2,
or
Informix.
Ecosystem
Science
and
Management
|
Texas
A&M
University
ESSM
464:
Spa*al
Project
Management
(c)
2015,
A.
Michelle
Lawing
SQL
Syntax
The
dialog
boxes
you
create
SQL
WHERE
clauses
with
help
you
use
the
correct
syntax
for
the
data
you're
querying
list
the
eld
names
and
values
with
the
appropriate
delimiters
select
the
relevant
keywords
and
operators
for
you
Ecosystem
Science
and
Management
|
Texas
A&M
University
ESSM
464:
Spa*al
Project
Management
(c)
2015,
A.
Michelle
Lawing
Searching
Strings
Strings
must
always
be
enclosed
within
single
quotes.
For
example
"STATE_NAME"
=
California
Searching
Strings
UCASE
and
LCASE
perform
the
same
opera*on
for
a
personal
geodatabase
Use
the
LIKE
operator
(instead
of
the
=
operator)
to
build
a
par*al
string
search.
For
example,
this
expression
would
select
Mississippi
and
Missouri
among
USA
state
names:
"STATE_NAME"
LIKE
'Miss%'
Ecosystem
Science
and
Management
|
Texas
A&M
University
ESSM
464:
Spa*al
Project
Management
(c)
2015,
A.
Michelle
Lawing
Search
Strings
%
means
that
anything
is
acceptable
in
its
place
one
character
a
hundred
characters
no
character
Alterna*vely,
if
you
want
to
search
with
a
wildcard
that
represents
one
character,
use
_
For
example,
this
expression
would
nd
Catherine
Smith
and
Katherine
Smith:
"OWNER_NAME"
LIKE
'_atherine
smith'
Ecosystem
Science
and
Management
|
Texas
A&M
University
ESSM
464:
Spa*al
Project
Management
(c)
2015,
A.
Michelle
Lawing
Search
Strings
The
wildcards
work
for
any
le-based
data
or
mul*user
geodatabase
data.
The
wildcards
you
use
to
query
personal
geodatabases
are
*
for
any
number
of
characters
and
?
for
one
character.
Wildcard
characters
appear
as
bujons
on
the
Select
by
Ajributes
and
Query
Builder
dialog
boxes.
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.
Ecosystem
Science
and
Management
|
Texas
A&M
University
ESSM
464:
Spa*al
Project
Management
(c)
2015,
A.
Michelle
Lawing
Search
Strings
Select
based
on
sor*ng
order
greater
than
(>)
less
than
(<)
greater
than
or
equal
(>=)
less
than
or
equal
(<=)
BETWEEN
not
equal
(<>)
For
example,
this
expression
will
select
all
the
ci*es
in
a
coverage
with
names
star*ng
with
the
lejers
M
to
Z:
"CITY_NAME"
>=
'M'
Ecosystem
Science
and
Management
|
Texas
A&M
University
ESSM
464:
Spa*al
Project
Management
(c)
2015,
A.
Michelle
Lawing
Searching
Numbers
Query
numbers
by
the
equal
(=)
not
equal
(<>)
greater
than
(>)
less
than
(<)
greater
than
or
equal
(>=)
less
than
or
equal
(<=)
BETWEEN
For
example
"POPULATION96"
>=
5000
Numeric
values
are
always
listed
using
the
point
as
the
decimal
delimiter
regardless
of
your
regional
se}ngs
(PROBLEM
IN
INTERNATIONAL
SETTING).
The
comma
cannot
be
used
as
a
decimal
or
thousands
delimiter
in
an
expression.
Ecosystem
Science
and
Management
|
Texas
A&M
University
ESSM
464:
Spa*al
Project
Management
(c)
2015,
A.
Michelle
Lawing
Calcula*ons
Calcula*ons
can
be
included
in
expressions
using
the
arithme*c
operators:
+
-
*
/
Calcula*ons
can
be
between
elds
and
numbers.
For
example:
"AREA"
>=
"PERIMETER"
*
100
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
isn't
enclosed.
"HOUSEHOLDS"
>
"MALES"
*
"POP90_SQMI"
+
"AREA
evaluates
dierently
from
"HOUSEHOLDS"
>
"MALES"
*
("POP90_SQMI"
+
"AREA")
Ecosystem
Science
and
Management
|
Texas
A&M
University
ESSM
464:
Spa*al
Project
Management
(c)
2015,
A.
Michelle
Lawing
Combining
expressions
Complex
expressions
can
be
built
by
combining
expressions
with
the
AND
and
OR
operators.
For
example,
the
following
expression
would
select
all
the
houses
that
have
more
than
1,500
square
feet
and
a
garage
for
three
or
more
cars:
"AREA"
>
1500
AND
"GARAGE"
>
3
When
you
use
the
OR
operator,
at
least
one
side
of
the
expression
of
the
two
separated
by
the
OR
operator
must
be
true
for
the
record
to
be
selected.
For
example:
"RAINFALL"
<
20
OR
"SLOPE"
>
35
Use
the
NOT
operator
at
the
beginning
of
an
expression
to
nd
features
or
records
that
don't
match
the
specied
expression.
For
example:
NOT
"STATE_NAME"
=
'Colorado'
NOT
expressions
can
be
combined
with
AND
and
OR.
For
example,
this
expression
would
select
all
the
New
England
states
except
Maine:
"SUB_REGION"
=
'New
England'
AND
NOT
"STATE_NAME"
=
'Maine'
Ecosystem
Science
and
Management
|
Texas
A&M
University
ESSM
464:
Spa*al
Project
Management
(c)
2015,
A.
Michelle
Lawing
Subqueries
A
subquery
is
a
query
nested
within
another
query
and
are
supported
by
geodatabase
data
sources
only.
They
can
be
used
to
apply
predicate
or
aggregate
func*ons
or
to
compare
data
with
values
stored
in
another
table.
For
example,
this
query
would
select
only
the
countries
that
are
not
also
listed
in
the
table
indep_countries:
"COUNTRY_NAME"
NOT
IN
(SELECT
"COUNTRY_NAME"
FROM
indep_countries)
For
more
informa*on,
see
SQL
Reference.
Ecosystem
Science
and
Management
|
Texas
A&M
University
ESSM
464:
Spa*al
Project
Management
(c)
2015,
A.
Michelle
Lawing
Querying
Dates
Some
changes
have
been
introduced
in
ArcGIS
9
for
building
expressions
that
query
date
elds.
The
appropriate
syntax
for
the
underlying
data
source
is
automa*cally
shown
in
the
unique
values
list
or
generated
by
the
Query
Builder.
Most
of
the
*me,
you
will
only
need
to
click
the
eld,
the
operator,
and
the
value
to
generate
the
proper
syntax.
Ecosystem
Science
and
Management
|
Texas
A&M
University
ESSM
464:
Spa*al
Project
Management
(c)
2015,
A.
Michelle
Lawing