Home > Backend Development > PHP Tutorial > The use of wildcards, escape characters and '[' signs in SQL (downmoon)_PHP tutorial

The use of wildcards, escape characters and '[' signs in SQL (downmoon)_PHP tutorial

WBOY
Release: 2016-07-13 17:02:10
Original
1536 people have browsed it

1. Instructions for searching for wildcard characters
You can search for wildcard characters. There are two ways to specify characters that are commonly used as wildcards:
Use the ESCAPE keyword to define escape characters. When an escape character precedes a wildcard character in a pattern, the wildcard character is interpreted as an ordinary character. For example, to search for a string that contains 5% of the string anywhere, use:
WHERE ColumnA LIKE '%5/%%' ESCAPE '/'
In the above LIKE clause, the leading and trailing 100 A semicolon (%) is interpreted as a wildcard character, and a percent sign after a slash (/) is interpreted as the % character.
Enclose only the wildcard character itself within square brackets ([ ]). To search for a dash (-) instead of specifying a search range with it, specify the dash as the first character inside square brackets:
WHERE ColumnA LIKE '9[-]5'
The following table shows the values ​​enclosed in Usage of wildcard characters within square brackets.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/631077.htmlTechArticle1. Instructions for searching wildcard characters You can search for wildcard characters. There are two ways to specify characters that are commonly used as wildcard characters: Use the ESCAPE keyword to define escape characters. In mode, when...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template