Skip To Content

What is a query layer?

A query layer is a layer or stand-alone table that is defined by an SQL query. Query layers allow both spatial and nonspatial information stored in a database to be easily integrated into GIS projects within ArcGIS Pro. Since query layers are using SQL to directly query database tables and views, spatial information used by a query layer is not required to be in a geodatabase.

When working in ArcGIS Pro, you create query layers by defining an SQL query. The query is then run against the tables and views in a database, and the result set is added to the map as a layer or stand-alone table (depending on the query).

The SQL query that defines a query layer is a static SQL statement that is executed inside the database every time the layer is displayed or used in the map. This allows the latest information to be visible without making a copy or snapshot of the data. This is especially useful when working with dynamic information that is frequently changing. However, there are many situations where parts of SQL statements are not known in advance. For example, to display aggregated rainfall in a region, you may not know beforehand whether to aggregate the rainfall station values by day, week, or month. Parameters in query layers can help make components of SQL statements dynamic.

Query layers allow ArcGIS Pro to integrate data from geodatabases as well as from database management systems. Therefore, query layers can quickly integrate spatial and nonspatial information into GIS projects independently of where and how that information is stored.

A quick tour of working with query layers

  • ArcGIS Pro users can add query layers to the map by defining a query against the tables and views in a database.
  • Query layers behave in the same way as other feature layers or stand-alone tables, so they can be used to display data, used as input to a geoprocessing tool, or accessed programmatically using developer APIs.

Related topics