开发者

MySQL Wildcards * and %

开发者 https://www.devze.com 2023-01-04 11:32 出处:网络
What is the difference between % and * wildcards in MySQL? I开发者_高级运维n a query like so : \"SELECT * FROM $table WHERE MATCH (message) AGAINST(\'$string*\' IN BOOLEAN MODE)\"* can only be used a

What is the difference between % and * wildcards in MySQL?

I开发者_高级运维n a query like so : "SELECT * FROM $table WHERE MATCH (message) AGAINST('$string*' IN BOOLEAN MODE)"


* can only be used as a wildcard (or truncation) in a full text search while % (match 0 or more characters) and _ (match exactly one character) are only applicable in LIKE-queries.


"An asterisk is the truncation operator. Unlike the other operators, it is appended to the word, or fragment, not prepended."

This only applies to MATCH() ... AGAINST() statements.

The % is a LIKE wildcard and has nothing to do with the MATCH() ... AGAINST().

I hope that helps.

0

精彩评论

暂无评论...
验证码 换一张
取 消