Skip to main content
Documents
Clauses StatementsKeywordsExpressionsFunctionsIndexesPerformance Optimization

MySQL SHOW COLLATION Statements

The SHOW COLLATION statement in MySQL is used to display information about available character set collations. It provides details such as collation name, character set, default status, and more.

Usage

The SHOW COLLATION statement is typically used to list all collations supported by the MySQL server, which can be helpful when setting or changing the collation for a database, table, or column.


SHOW COLLATION [LIKE 'pattern' | WHERE expr];

In this syntax, SHOW COLLATION can be optionally filtered using LIKE or WHERE to specify a pattern or condition. Consider that using this statement on large databases might have performance implications, so it is advised to use filtering options to limit the result set.

Examples

1. Basic Collation Listing


SHOW COLLATION;

This command lists all available collations, displaying comprehensive details like collation names and their corresponding character sets.

2. Filtering with LIKE


SHOW COLLATION LIKE 'utf8%';

This example filters the list to show only collations that start with 'utf8', which are commonly used for UTF-8 encoded text.

3. Using WHERE Clause


SHOW COLLATION WHERE Charset = 'latin1';

This usage filters collations to display only those associated with the 'latin1' character set, ideal for locating specific character set collations.

Tips and Best Practices

  • Use filters such as LIKE or WHERE to narrow down results when looking for specific collations, which can improve query performance and readability.
  • Understand defaults and common collations. Familiarize yourself with common collations for the character sets you frequently use and understand which collations are default for particular character sets. This ensures compatibility and optimal behavior.
  • Stay updated. Be aware that available collations can change with different versions of MySQL.

SQL Upskilling for Beginners

Gain the SQL skills to interact with and query your data.
Start Learning for Free