Mast head image

Data to Link to GIS layer with MUKEY Column

This script retrieves a parent table of map unit symbols and names with a multipart related child table for components. The map unit table has a primary key (Table_Id) and the component table has a corresponding foreign key to link the data together.


Text highlighted in yellow in the example script can be changed for a particular area; e.g., 'MO123' can be substituted for 'NE109'. Also you can use wildcards to get the entire State; e.g., 'MO%' will extract the State of Missouri. More examples can be found on the TIPS page.

Tips Page

Copy the example script below and paste it into the query page on the Soil Data Access site.

Soil Data Access Query Page

Example Script

SHAPE {

SELECT musym AS Map_unit_symbol, muname AS Map_unit_name, mukey AS MUKEY

FROM legend AS l

INNER JOIN mapunit AS mu ON l.lkey = mu.lkey

WHERE areasymbol = 'NE079'

ORDER BY museq}

APPEND ({

SELECT mu.mukey AS MUKEY, comppct_r AS component_Percent, compname AS Component_name

FROM legend AS l

INNER JOIN mapunit AS mu ON l.lkey = mu.lkey

LEFT OUTER JOIN component AS c ON mu.mukey = c.mukey

WHERE areasymbol = 'NE079'

ORDER BY comppct_r DESC, compname}

AS component RELATE mukey TO mukey)

Example Table Output

Description of tables and columns can be found on this link: Table and Column Descriptions

Map_unit_symbol Map_unit_name MUKEY Table_ID
1021 Caruso loam, rarely flooded 1700110 0
2321 Inavale fine sand, 0 to 3 percent slopes 2228231 1


MUKEY Coponent_percent Component_name Table_ID
1700110 85 Caruso 0
1700110 8 Janude 0
1700110 7 Alda 0
2228231 7 Inavale 1

For additional information on constructing and using shape commands, please see a current text on Active X Data Objects (ADO or search the Internet using the key phrase "ADO shape command". As of August 2017, an introduction to shape command syntax was available as an article in the Microsoft Knowledge Base at the following URL:

Microsoft Support page

Helping People Help the Land

USDA is an equal opportunity provider, employer, and lender.