In MySQL, how do you use SQL statements to view the encoding of a table? We use show create TABLE, a SQL statement, to solve this problem.
Show CREATE table can view the SQL statement script that created the table, and its basic syntax is:
Show CREATE table < table name >;
We use it to look at the Create script for the test table:
Mysql> Show create table test;
+-------+---------------------------------------------
---------------------------------------------------- --
-------------------------------------------+
| Table | Create Table
+-------+---------------------------------------------
----------------------------------- -------------------
-------------------------------------------+
| test | CREATE TABLE ' test ' (
' t_id ' int () DEFAULT null,
' t_name ' varchar NOT NULL,
' T_password ' char () DEF Ault 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 there is this sentence: DEFAULT charset=latin1, which indicates that the character encoding type of the test table is: Latin1.
Also, we can see from this result that the engine for the current table is the InnoDB engine. This information is also very important.
Above this MySQL use SQL statement to see a table coding method is small series to share all the content, hope to give you a reference, but also hope that we support cloud habitat community.