简体   繁体   English

不区分大小写的MySQL搜索?

[英]case-insensitive search of MySQL?

case-insensitive search of MySQL? 不区分大小写的MySQL搜索?

For my site search, what is the most efficient way of to query my db for a word/phrase regardless of case? 对于我的网站搜索,无论大小写,查询我的数据库的单词/短语的最有效方法是什么?

If your database / table is not set up with a case-insensitive collate you need to append something like COLLATE utf8_general_ci to your query. 如果您的数据库/表未设置为不区分大小写的整理,则需要在查询中附加COLLATE utf8_general_ci等内容。 (The _ci suffix stands for case insensitive.) _ci后缀代表不区分大小写。)

Have a look at the documentation: 9.1.7.1. 看一下文档: 9.1.7.1。 Using COLLATE in SQL Statements : 在SQL语句中使用COLLATE

With the COLLATE clause, you can override whatever the default collation is for a comparison. 使用COLLATE子句,您可以覆盖默认排序规则以进行比较。 COLLATE may be used in various parts of SQL statements. COLLATE可用于SQL语句的各个部分。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM