The table "Special character interpretations" shows the allowed syntax for all special characters, except asterisk and hyphen.
The asterisk and hyphen characters are not considered special characters, if they are found in a phrase, and are dropped.
The restrictions on specifying string literals also apply to the query string. For example, apostrophes must be within an escape sequence.
Character or syntax |
Usage examples and remarks |
---|---|
ampersand (&) |
|
vertical bar (|) |
|
double quotes (") |
Double quotes are used to contain a sequence of terms where order and relative distance are important. For example, in the query string 'learn "full text search"', "full text search" is a phrase. In this example, learn can come before or after the phrase, or exist in another column (if the TEXT index is built on more than one column), but the exact phrase must be found in a single column. |
parentheses () |
Parentheses are used to specify the order of evaluation of expressions, if different from the default order. For example, 'a AND (b|c)' is interpreted as a, and b or c. |
tilde (~) |
The tilde is equivalent to NEAR, and has no special syntax rules. The query string 'full~text' is equivalent to 'full NEAR text', and is interpreted as: the term full within ten terms of the term text. |
square brackets [ ] |
Square brackets are used in conjunction with the keyword NEAR to contain distance. Other uses of square brackets return an error. |