Use query layers to create new layers or standalone tables that are defined by SQL queries. Any SQL that works in the database will work with query layers. User-defined queries are executed on the layer each time the data is used or rendered, which ensures the layer or table data is current. Query layers work in the same way as other ArcMap layers.
After a query has been created it can be saved as a layer file (.lyr) or used to create a layer package (.lpk) file. This makes it easy to share query layers with other applications, map documents, and users.
Map documents can be saved and published to ArcGIS Server, which makes Query layer information available to ArcGIS Server APIs. Query layers can also be created on spatial data in databases that do not contain a geodatabase.
Query layers support the use of spatial joins and relates.