Home > php教程 > php手册 > SQL中通配符、转义符与"["号的使用(downmoon)

SQL中通配符、转义符与"["号的使用(downmoon)

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-13 10:05:45
Original
1842 people have browsed it

一、搜索通配符字符的说明
可以搜索通配符字符。有两种方法可指定平常用作通配符的字符:
使用 ESCAPE 关键字定义转义符。在模式中,当转义符置于通配符之前时,该通配符就解释为普通字符。例如,要搜索在任意位置包含字符串 5% 的字符串,请使用:
WHERE ColumnA LIKE '%5/%%' ESCAPE '/'
在上述 LIKE 子句中,前导和结尾百分号 (%) 解释为通配符,而斜杠 (/) 之后的百分号解释为字符 %。
在方括号 ([ ]) 中只包含通配符本身。要搜索破折号 (-) 而不是用它指定搜索范围,请将破折号指定为方括号内的第一个字符:
WHERE ColumnA LIKE '9[-]5'
下表显示了括在方括号内的通配符的用法。

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
Latest Issues
sql file
From 1970-01-01 08:00:00
0
0
0
php - Overhead of prepare vs sql?
From 1970-01-01 08:00:00
0
0
0
Print sql statement
From 1970-01-01 08:00:00
0
0
0
Pass array to SQL insert query using PHP
From 1970-01-01 08:00:00
0
0
0
sql optimization or
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template