Using spatial SQL
Don’t
be intimidated by the term spatialSQL. It is one of the most powerful tools in GIS,
is easy to use, and is way more flexible than any wizard you can develop. But, it will require you to write a couple of
lines of SQL code. This document will
help you do that.
SQL
stand for structured query language, which is the most common database
language. The spatial part means we can
add spatial operators to a standard database language. Examples of SQL and spatialSQL
that you can use are the following:
Select
all parcels with a property class of single family residential
SELECT
* FROM PARCELS WHERE PROP_CLASS = 210
Select
all parcels that are either single family residential or multi-family
residential
SELECT
* FROM PARCELS WHERE PROP_CLASS in (210,220)
Select
all parcels that are either single family residential or multi-family
residential and have a value over $300,000
SELECT
* FROM PARCELS WHERE PROP_CLASS in (210,220) AND TOT_VALUE > 300000
Select
all parcels that are within 100 feet of a wetland boundary
SELECT PARCELS.* from parcels,dec_wetland
where distance(parcels.id,dec_wetland.id) < 300
Select
all single family residential parcels that are within 100 feet of a wetland
boundary
SELECT PARCELS.* from parcels,dec_wetland
where distance(parcels.id,dec_wetland.id) < 300 AND PROP_CLASS = 210
Select
all single family residential parcels that are within 100 feet of stream
SELECT PARCELS.* from parcels,STREAM
where distance(parcels.id,STREAM.id) < 300 AND PROP_CLASS = 210
Select
the owner name and address for parcels adjacent to an individual
parcel
SELECT Parcels.ID, OWNER_NAME, STREET_ADD, CITY_STATE
FROM PARCELS WHERE ADJACENT((SELECT id FROM PARCELS
WHERE [CC_PRINT_K] = "00100000010252000000") ,PARCELS.ID)