MySQL Table Collation: How to View Sorting Rules
To view the sorting rules of a MySQL table, you can access the metadata information of the table through a SQL query. You can use the following SQL query statement to view the sorting rules of the table:
SHOW TABLE STATUS LIKE 'table_name';
In the statement above, replace table_name with the name of the table you want to query. Executing this query will return a result set containing table information, including the sorting rule. Look for the Collation column in the result set, which represents the table’s sorting rule.
Note: The values in the Collation column are typically displayed in the form of a combination of a character set (such as utf8) and a sorting rule (such as utf8_general_ci). The sorting rule part describes the rules used for comparing and sorting strings.
Please note that if you are using MySQL 8.0 or a later version, you can use the following query to retrieve information about the sorting rules of a table:
SELECT table_name, table_collation
FROM information_schema.tables
WHERE table_schema = 'your_database_name' AND table_name = 'your_table_name';
In this query, replace your_database_name with the name of your database, and replace your_table_name with the table you want to query.