MySQL uses SQL statements to view the encoding method of a table.
In MySQL, how does one use SQL statements to view the encoding of a table? We use the show create table SQL statement to solve this problem.
Show create table allows you to view the SQL statement script for creating this table. Its basic syntax is:
Show create table <table Name>;
Let's use it to look at the create script of the test table:
mysql> show create table test;+-------+----------------------------------------------------------------------------------------------------------------------------------------------+| Table | Create Table+-------+----------------------------------------------------------------------------------------------------------------------------------------------+| test | CREATE TABLE `test` ( `t_id` int(11) DEFAULT NULL, `t_name` varchar(50) NOT NULL, `t_password` char(32) DEFAULT NULL, `t_birth` date DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1 |+-------+----------------------------------------------------------------------------------------------------------------------------------------------+1 row in set (0.00 sec)
From this result, we can see that the default charset = latin1 indicates that the character encoding type of the test table is latin1.
In addition, we can also see from this result that the engine of the current table is the InnoDB engine. This information is also very important.
In the above MySQL article, the encoding method for viewing a table using SQL statements is all the content that I have shared with you. I hope to give you a reference, and I hope you can provide more support to the customer's house.