MySQL :: MySQL 5.7 Reference Manual :: Collation of Expressions

MySQL :: MySQL 5.7 Reference Manual :: Collation of Expressions Contact MySQL  |  Login  |  Register The world's most popular open source database MySQL.com Downloads Documentation Developer Zone Developer Zone Downloads MySQL.com Documentation MySQL Server MySQL Enterprise Workbench Router Utilities/Fabric MySQL NDB Cluster Connectors More MySQL.com Downloads Developer Zone Section Menu:   Documentation Home MySQL 5.7 Reference Manual Preface and Legal Notices General Information Installing and Upgrading MySQL Using MySQL as a Document Store Tutorial MySQL Programs MySQL Server Administration Security Backup and Recovery Optimization Language Structure Globalization Character Set Support Character Sets and Collations in General Character Sets and Collations in MySQL String Repertoire UTF-8 for Metadata Specifying Character Sets and Collations Collation Naming Conventions Server Character Set and Collation Database Character Set and Collation Table Character Set and Collation Column Character Set and Collation Character String Literal Character Set and Collation The National Character Set Character Set Introducers Examples of Character Set and Collation Assignment Compatibility with Other DBMSs Connection Character Sets and Collations Configuring Application Character Set and Collation Error Message Character Set Column Character Set Conversion Collation Issues Using COLLATE in SQL Statements COLLATE Clause Precedence Character Set and Collation Compatibility Collation of Expressions The binary Collation Compared to _bin Collations Examples of the Effect of Collation Using Collation in INFORMATION_SCHEMA Searches Unicode Support The utf8 Character Set (3-Byte UTF-8 Unicode Encoding) The utf8mb3 Character Set (Alias for utf8) The utf8mb4 Character Set (4-Byte UTF-8 Unicode Encoding) The ucs2 Character Set (UCS-2 Unicode Encoding) The utf16 Character Set (UTF-16 Unicode Encoding) The utf16le Character Set (UTF-16LE Unicode Encoding) The utf32 Character Set (UTF-32 Unicode Encoding) Converting Between 3-Byte and 4-Byte Unicode Character Sets Supported Character Sets and Collations Unicode Character Sets West European Character Sets Central European Character Sets South European and Middle East Character Sets Baltic Character Sets Cyrillic Character Sets Asian Character Sets The Binary Character Set Setting the Error Message Language Adding a Character Set Character Definition Arrays String Collating Support for Complex Character Sets Multi-Byte Character Support for Complex Character Sets Adding a Collation to a Character Set Collation Implementation Types Choosing a Collation ID Adding a Simple Collation to an 8-Bit Character Set Adding a UCA Collation to a Unicode Character Set Defining a UCA Collation Using LDML Syntax LDML Syntax Supported in MySQL Diagnostics During Index.xml Parsing Character Set Configuration MySQL Server Time Zone Support Staying Current with Time Zone Changes Time Zone Leap Second Support MySQL Server Locale Support Data Types Functions and Operators SQL Statement Syntax The InnoDB Storage Engine Alternative Storage Engines High Availability and Scalability Replication MySQL NDB Cluster 7.5 Partitioning Stored Programs and Views INFORMATION_SCHEMA Tables MySQL Performance Schema MySQL sys Schema Connectors and APIs Extending MySQL MySQL Enterprise Edition MySQL Workbench MySQL 5.7 Frequently Asked Questions Errors, Error Codes, and Common Problems Restrictions and Limits Indexes MySQL Glossary Related Documentation MySQL 5.7 Release Notes Download this Manual PDF (US Ltr) - 35.7Mb PDF (A4) - 35.7Mb PDF (RPM) - 34.7Mb EPUB - 8.7Mb HTML Download (TGZ) - 8.5Mb HTML Download (Zip) - 8.5Mb HTML Download (RPM) - 7.3Mb Eclipse Doc Plugin (TGZ) - 9.3Mb Eclipse Doc Plugin (Zip) - 11.5Mb Man Pages (TGZ) - 203.5Kb Man Pages (Zip) - 308.9Kb Info (Gzip) - 3.3Mb Info (Zip) - 3.3Mb Excerpts from this Manual MySQL Backup and Recovery MySQL Globalization MySQL Information Schema MySQL Installation Guide MySQL and Linux/Unix MySQL and OS X MySQL Partitioning MySQL Performance Schema MySQL Replication Using the MySQL Yum Repository MySQL Restrictions and Limitations Security in MySQL MySQL and Solaris Building MySQL from Source Starting and Stopping MySQL MySQL Tutorial MySQL and Windows MySQL Cluster NDB 7.5 version 5.7 8.0 5.6 5.5 5.6  Japanese MySQL 5.7 Reference Manual  /  ...  /  Globalization  /  Character Set Support  /  Collation Issues  /  Collation of Expressions Collation of Expressions In the great majority of statements, it is obvious what collation MySQL uses to resolve a comparison operation. For example, in the following cases, it should be clear that the collation is the collation of column charset_name: SELECT x FROM T ORDER BY x; SELECT x FROM T WHERE x = x; SELECT DISTINCT x FROM T; However, with multiple operands, there can be ambiguity. For example: SELECT x FROM T WHERE x = 'Y'; Should the comparison use the collation of the column x, or of the string literal 'Y'