Home > Database > Mysql Tutorial > MySQL数据库搜索中大小写敏感性

MySQL数据库搜索中大小写敏感性

WBOY
Release: 2016-06-07 16:19:50
Original
1087 people have browsed it

在默认情况下,MySQL搜索不区分大小写(但某些字符集始终区分大小写,如czech)。这意味着,如果你使用col_name LIKE 'a%'进行搜索,你将获得以A或a开始的所有列。如果打算使搜索区分大小写,请确保操作数之一具有区分大小写的或二进制校对。例如,如果你正在

  在默认情况下,MySQL搜索不区分大小写(但某些字符集始终区分大小写,如czech)。这意味着,如果你使用col_name LIKE 'a%'进行搜索,你将获得以A或a开始的所有列。如果打算使搜索区分大小写,请确保操作数之一具有区分大小写的或二进制校对。例如,如果你正在比较均适用latin1字符集的列和字符串,可使用COLLATE操作符,,使1个操作数具有latin1_general_cs或latin1_bin校对特性。例如:

  col_name COLLATE latin1_general_cs LIKE 'a%'

  col_name LIKE 'a%' COLLATE latin1_general_cs

  col_name COLLATE latin1_bin LIKE 'a%'

  col_name LIKE 'a%' COLLATE latin1_bin

  如果希望总是以区分大小写的方式处理列,可使用区分大小写的或二进制校对声明它。

  简单的比较操作(>=, >, =,

Related labels:
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