Table Select (Analysis)

License Level:BasicStandardAdvanced

Summary

Selects table records matching a Structured Query Language (SQL) expression and writes them to an output table.

Usage

Syntax

TableSelect_analysis (in_table, out_table, {where_clause})
ParameterExplanationData Type
in_table

The table whose records matching the specified expression will be written to the output table.

Table View; Raster Layer
out_table

The output table containing records from the input table that match the specified expression.

Table
where_clause
(Optional)

An SQL expression used to select a subset of records. For more information on SQL syntax see the help topic SQL reference for query expressions used in ArcGIS.

SQL Expression

Code Sample

Table Select Example (Python Window)

The following Python Window script demonstrates how to use the Table Select function in immediate mode.

import arcpy
from arcpy import env

env.workspace = "C:/data"
arcpy.TableSelect_analysis("majorrds.shp", "C:/output/majorrdsCl4.shp", '"CLASS" = \'4\'')
Table Select Example 2 (Stand-alone Python Script)

The following Python script demonstrates how to use the Table Select function in a stand-alone script.

# Name: TableSelect_Example2.py
# Description: Selct class4 roads from the major roads gnatcatcher habitat study area
# Author: ESRI

# Import system modules
import arcpy
from arcpy import env

# Set workspace
env.workspace = "C:/data"

# Set local variables
in_features = "majorrds.shp"
out_feature_class = "C:/output/majorrdsCl4.shp"
where_clause = '"CLASS" = \'4\''

# Execute TableSelect
arcpy.TableSelect_analysis(in_features, out_feature_class, where_clause)

Environments

Related Topics

Licensing Information

ArcGIS for Desktop Basic: Yes
ArcGIS for Desktop Standard: Yes
ArcGIS for Desktop Advanced: Yes
3/3/2014