Query Syntax of SQL Query Language
Note
Indexing Service is no longer supported as of Windows XP and is unavailable for use as of Windows 8. Instead, use Windows Search for client side search and Microsoft Search Server Express for server side search.
A typical sequence of statements in the SQL query language consists of the following.
SET Property_Name_Clause | Rank_Method_Clause
...
CREATE VIEW #View_Name
AS SELECT Select_List
FROM_Clause
...
SELECT Select_List | *
FROM_Clause
[ WHERE_Clause ]
[ ORDER_BY_Clause ]
SQL statements can be submitted individually, or batched together. The following table lists the component statements and clauses in their usual order of use and briefly summarizes each.
Statement or Clause | Description |
---|---|
SET statement | Maps document-specific properties to column names or selects a ranking method for content searches. |
CREATE VIEW statement | Associates a subset of properties with a user-defined virtual table name that can then be used to satisfy queries. Several predefined views can be used. |
SELECT statement | Retrieves rows by specifying the columns of interest, the scope (the set of documents) for the search, and the search criteria. |
FROM clause | Part of the SELECT statement that defines the query scope by specifying the documents on which to perform the search. |
WHERE clause | Optional part of the SELECT statement that specifies the rows in the virtual table that make up the resulting rowset. |
ORDER BY clause | Optional part of the SELECT statement that sorts the rows returned in the rowset according to a specified set of criteria. |
Batched statements | Allow setting and executing several SQL statements, optionally separated by semicolons, as one command. |