Advanced Query Syntax (Aqs)


What is a query ?

Query is another word for question. In fact, outside of computing terminology, the words “query” and “question” can be used interchangeably. For example, if you need additional information from someone, you might say, “I have a query for you.” In computing, queries are also used to retrieve information

A query is a question, often expressed in a formal way. A database query can be either a select query or an action query. A select query is a data retrieval query, while an action query asks for additional operations on the data, such as insertion, updating or deletion.

What are the types of queries?

What are the 3 types of select query?

Select queries are the most common queries and can be used for viewing and a data source for forms, reports, controls, and other queries.

Query Types

  • Select Queries. Retrieve records or summaries (totals) across records. …
  • Make Table Queries. …
  • Append Queries. …
  • Update Queries. …
  • Delete Queries.

How does a query work?

A query can either be a request for data results from your database or for action on the data, or for both. A query can give you an answer to a simple question, perform calculations, combine data from different tables, add, change, or delete data from a database.

What is a query syntax?

Query syntax is similar to SQL (Structured Query Language) for the database. It is defined within the C# or VB code


Advanced Query Syntax (AQS) is the default query syntax used by Windows Search to query the index and to refine and narrow search parameters. AQS is employed by developers to build queries programmatically (and by users to narrow their search parameters). Canonical AQS was introduced in Windows 7 and must be used in Windows 7 and later to programmatically generate AQS queries.

Using Advanced Query Syntax Programmatically

About Advanced Query Syntax

A query consists of basic queries connected with AND, OR, and NOT, as shown in the following example syntax:syntax Copy

<query> ::=
     <basic query>
| ( <query> )
| <query> AND <query>  
| <query> <query>    // Same as <query> AND <query>
| <query> OR <query> 
| NOT <query>


AQS is not case sensitive, with the exception of AND, OR, and NOT, which must be in all uppercase.

If a query has two or more uses of AND or OR, they will bind from left to right, regardless of whether it is AND or OR. That is, the query, “apple AND pear OR plum” will be interpreted as if it were written as “(apple AND pear) OR plum”, and the query, “apple OR pear AND plum”, will be interpreted as if it were written as “(apple OR pear) AND plum”. So if a document contains the word plum but neither apple, nor pear, the first query will return it but the second query will not. Hence, we recommend that you use explicit parentheses for any query that mixes AND and OR to avoid mistakes or misinterpretations.

A basic query searches for items that satisfy a restriction over a property. The only required portion of a basic query is the restriction or search value. If you do not specify a property, Windows Search searches all properties. represents the search restriction.

The following forms for a basic query are valid:syntax Copy

<basic query> ::=
     <prop>:<basic restr>
| <restr>

A property is designated by a keyword such as author or size, or by a canonical property name such as System.DateModified. Valid forms for a property are as follows:syntax Copy

<prop> ::= 
     <canonical property name>
| <property label in UI language>

An operator indicates an operation such as < or =. For a list of valid operators, see the Query Operators section later in this topic.

A basic restriction is a simple restriction on a property that can be written without parentheses:syntax Copy

<basic restr> ::=
| <op><value>
| NOT <basic restr>
| ( <restr> )

A restriction is a search value such as a number value or string value, optionally with an operator. Valid forms for a restriction are as follows:syntax Copy

<restr> ::=
    <basic restr>
| <restr> AND <restr>
| <restr> <restr>      // Same as <restr> AND <restr>
| <restr> OR <restr>

If you do not specify an operator, Windows Search chooses the most appropriate operator for your query:

  • For a string property, the COP_WORD_STARTSWITH $< operator is assumed.
  • For all other properties, the COP_EQUAL = operator is assumed.

For the programmatic use of AQS, we recommend that you always have an explicit operator. The valid form for searching a simple value or value range is as follows:syntax Copy

<value> ::=
| <simplevalue> .. <simplevalue>

A simple value can consist of any of the following types:syntax Copy

<simplevalue> ::=
  []         // No value, or a null value
| <word>     // A sequence of characters without whitespace
| <number>   // An integer or a floating point number
| <datetime> // A relative date, or an absolute date and/or time
| <Boolean>
| "..."      // A phrase
| <enumeration range>


A query that searches for a document containing the phase “last quarter,” authored by Theresa or Lee, and that was saved to the folder MyDocs, combines three basic queries as follows:syntax Copy

"last quarter" author:(theresa OR lee) folder:MyDocs

The three basic queries are:

  • “last quarter”
  • author:(theresa OR lee)
  • folder:MyDocs

A basic query that uses canonical syntax is:syntax Copy



Properties are referred to by a keyword, which can be a canonical property name in Windows 7 and later. AQS in the Windows UI can use the label instead of the canonical property name, such as author instead of System.Author. In Windows Vista and earlier it was possible to use English labels regardless of the UI language. In Windows 7 and later, Windows Search recognizes keywords in the current default UI language only.

Advantages and Disadvantages of SQL – GeeksforGeeks

Advantages of SQL :
SQL has many advantages which makes it popular and highly demanded. It is a reliable and efficient language used for communicating with the database. Some advantages of SQL are as follows:

  1. Faster Query Processing –
    Large amount of data is retrieved quickly and efficiently. Operations like Insertion, deletion, manipulation of data is also done in almost no time.
  2. No Coding Skills –
    For data retrieval, large number of lines of code is not required. All basic keywords such as SELECT, INSERT INTO, UPDATE, etc are used and also the syntactical rules are not complex in SQL, which makes it a user-friendly language.
  3. Standardised Language –
    Due to documentation and long establishment over years, it provides a uniform platform worldwide to all its users.
  4. Portable –
    It can be used in programs in PCs, server, laptops independent of any platform (Operating System, etc). Also, it can be embedded with other applications as per need/requirement/use.
  5. Interactive Language –
    Easy to learn and understand, answers to complex queries can be received in seconds.
  6. Multiple data views –

Disadvantages of SQL :
Although SQL has many advantages, still there are a few disadvantages.
Various Disadvantages of SQL are as follows:

  1. Complex Interface –
    SQL has a difficult interface that makes few users uncomfortable while dealing with the database.
  2. Cost –
    Some versions are costly and hence, programmers cannot access it.
  3. Partial Control –
    Due to hidden business rules, complete control is not given to the database.

Applications of SQL :

  • SQL is used by developers and DBAs (Database Administrators) in writing Data Integration Scripts.
  • It is used to deal with analytical queries to analyze the data and get instincts from it.
  • Retrieving Information
  • Modification/Manipulation of data and database table such as Insertion, Deletion and Updation.

drop your comment


Author: refuge_2020

Leave a Reply

Your email address will not be published. Required fields are marked *