Skip to content

Things to Consider When Writing Queries

Dylan Beaudette edited this page Jul 13, 2017 · 2 revisions

A pair of dashes "--" denotes the beginning of a comment.

The number of rows for an immediate query is limited to 10,000. If the query output exceeds this limit then submit the query as queued or reduce the size of the area of interest (AOI).

The scope of each query can be altered by changing the area symbol or by adding additional conditions. The area symbol corresponds to the soil survey area code not the county FIPS code. e.g. Ste. Genevieve County, Missouri the FIPS code is MO186 and the soil survey area symbol is MO193. The area symbol for some multi-county surveys or partially mapped county surveys is in the 600s. The STATSGO area is identified by 'US' and SSURGO maps are identified by 'non-MLRA soil survey areas'. If you do not specify an area symbol, the query will probably timeout or exceed the limit for returned rows. When running queries against the whole nation, be sure to specify STATSGO or SSURGO; otherwise, you will get both area types and they are not easily distinguished from each other. To get STATSGO only use area symbol='US'. To get all SSURGO areas use area symbol<>'US'.

Wild cards can be used in a query to filter the data. Examples are shown in the tables below.

The following link takes you to a list of all the Table and Column names in the SURRGO database: Table And Column Name Report

Examples of parameters that can be applied to filter your data.

All sample queries are written to retrieve data from only one area e.g. 'NE109', so that they will run immediately. The parameter for the area symbol can be changed. See tables below for examples.

The "Applied Parameter" is the term that you can change in the scripts to alter the area of interest (AOI). The "Data Returned" is the output in the returned report.uce the size of the area of interest (AOI).