Other References
The last three references for this appendix include Table B.17, how to store special characters in a database; Table B.18, how to weight keywords in a binary-mode full-text search; and Table B.19, significant characters for regular expressions.
Table B.17. These characters all have special meanings when used in queries. The letters are all case-sensitive! The percentage character and the underscore are necessary because these characters, when not escaped, can be used as wildcards in searches.Escape Characters |
---|
Character | Meaning |
---|
\' | Single quotation mark | \' | Double quotation mark | \b | Backspace | \n | Newline | \r | Carriage return | \t | Tab | \\ | Backslash | \% | Percentage character | \_ | Underscore character |
Table B.18. As of version 4 of MySQL, you can perform full-text searches in binary mode, using these symbols.Special Boolean Mode Characters |
---|
Character | Meaning | Example | Matches |
---|
+ | Word is required | +punk rock | punk is required and rock is optional. | - | Word must not be present | +punk -rock | punk is required and rock cannot be present. | "" | A literal phrase | "punk rock" | Occurrences of the phrase punk rock are weighted. | < | Less important | <punk +rock | rock is required and punk is less significant. | > | More important | >punk +rock | rock is required but punk is more significant. | () | Creates groups | (>punk roll) +rock | rock is required, both punk and roll are optional, but punk is weighted more. | ~ | Detracts from relevance | +punk ~rock | punk is required, and the presence of rock devalues the relevance (but rock is not excluded). | * | Allows for wildcards | +punk +rock* | punk and rock are required, but rocks, rocker, rocking, etc., are counted. |
Table B.19. When using REGEX and NOT REGEX, you'll need to define patterns with the characters listed here.Special Regular Expression Characters |
---|
Character | Matches |
---|
. | Any single character | q? | Zero or one q | q* | Zero or more q's | q+ | At least one q | q{x} | Exactly x instances of q | q{x,} | At least x instances of q | q{,x} | Up to x instances of q | q{x,y} | Between x and y instances of q | ^q | Starts with q | q$ | Ends with q | (pqr) | Grouping (matches pqr) | q|z | Either q or z | [] | Character classes (e.g., [a-z], [0-9]) | \ | Escapes a special character (\., \*, etc.) |
 |