Home >Database >Mysql Tutorial >How to convert Chinese to Pinyin in mysql
Mysql method of converting Chinese to Pinyin: First create a database and create a Chinese character and Pinyin comparison table; then use the "INSERT INTO t_base_pinyin () VALUES ()" statement to add a comparison to the Chinese Pinyin comparison table Data; finally create a function that converts Chinese characters into pinyin.
Recommended: "mysql video tutorial"
The first step is to open the software and create a database, as follows As shown in the picture:
# After creating the database in the second step, you need to create a Chinese character and pinyin comparison table, and use the create table statement to create the table, as shown in the following figure:
In the third step, we open the table and we can see that a table named t_base_pinyin has been successfully created and contains two fields: pin_yin_ and code_, as shown in the following figure:
In the fourth step, we use the INSERT INTO t_base_pinyin () VALUES () statement to add comparison data to the Chinese pinyin comparison table, as shown in the following figure:
In the fifth step, we open t_base_pinyin, and we can see that the control data has been inserted successfully, as shown in the figure below:
In the sixth step, we finally need Create a function that converts Chinese characters into pinyin, and executes it after the input is completed. The statement is as shown in the figure below
In the seventh step, we enter the select to_pinyin('test') statement to query. You can see that the output to_pinyin('test'),ceshi, has successfully converted Chinese into Pinyin, as shown in the figure below:
The above is the detailed content of How to convert Chinese to Pinyin in mysql. For more information, please follow other related articles on the PHP Chinese website!