2.1.3 Queries
A Query in this protocol defines a way to build a query to be used as an object in a database application. It is a subset of the functionality defined by the SELECT statement in Transact-SQL ([MSDN-TSQL-Ref]).
A Query can be used to filter, order or group data. It can also be used to bring together data from more than one input source. Queries can take input in the form of parameters, which can be included in the output columns as part of an expression or used to filter the query results. Queries can use expressions in output columns, in restrictions, in groupings, in orderings or in group restrictions to perform calculations or formatting on data. Queries can also group data and filter these groups according to the data in those groups.
Queries include components that map to the following clauses of a SELECT statement as expressed by Transact-SQL ([MSDN-TSQL-Ref]). Restrictions on what is permitted for each Query component are described in the linked sections in this document.
Transact-SQL Clause |
Query AXL |
---|---|
SELECT |
|
DISTINCT |
Distinct attribute of Query (section 2.2.3.18) |
TOP |
Top Rows (section 2.2.3.76) and Top Percent (section 2.2.3.77) |
FROM |
|
WHERE |
Restriction child element of Query (section 2.2.3.18) |
GROUP BY |
Groups (section 2.2.3.74) |
HAVING |
GroupRestriction child element of Query (section 2.2.3.18) |
ORDER BY |
Ordering (section 2.2.3.3) |