Rechercher dans le manuel MySQL

10.10.8 The Binary Character Set

The binary character set is the chararcter set of binary strings, which are sequences of bytes. The binary character set has one collation, also named binary. Comparison and sorting are based on numeric byte values. The effect is that lettercase and accent differences are significant in comparisons. That is, the binary collation is case-sensitive and accent sensitive.

  1. mysql> SET NAMES 'binary';
  2. mysql> SELECT CHARSET('abc'), COLLATION('abc');
  3. +----------------+------------------+
  4. | CHARSET('abc') | COLLATION('abc') |
  5. +----------------+------------------+
  6. | binary         | binary           |
  7. +----------------+------------------+
  8. mysql> SELECT 'abc' = 'ABC', 'a' = 'ä';
  9. +---------------+------------+
  10. | 'abc' = 'ABC' | 'a' = 'ä'  |
  11. +---------------+------------+
  12. |             0 |          0 |
  13. +---------------+------------+

For information about the differences between the binary collation of the binary character set and the _bin collations of nonbinary character sets, see Section 10.8.5, “The binary Collation Compared to _bin Collations”.

To convert a string expression to a binary string, any of these constructs are equivalent:

  1. BINARY expr
  2. CAST(expr AS BINARY)

If expr is a character string literal, the _binary introducer may be used to designate it as a binary string. For example:

  1. _binary 'a'

The _binary introducer is permitted for hexadecimal literals and bit-value literals as well, but unnecessary; such literals are binary strings by default.

For more information about introducers, see Section 10.3.8, “Character Set Introducers”.


Find a PHP function

Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-charset-binary-set.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.

References

  1. View the html document Language of the document:en Manuel MySQL : https://dev.mysql.com/

These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.

Contents Haut