• MySQL汉字转拼音方案


    1.创建表

    -- sys.pinyintable definition
    CREATE TABLE `pinyintable` (
      `id` int NOT NULL,
      `pin_yin` varchar(255) DEFAULT NULL,
      `code` varchar(255) DEFAULT NULL,
      PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    2.插入数据

    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(1,'a','20319');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(2,'ai','20317');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(3,'an','20304');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(4,'ang','20295');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(5,'ao','20292');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(6,'ba','20283');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(7,'bai','20265');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(8,'ban','20257');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(9,'bang','20242');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(10,'bao','20230');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(11,'bei','20051');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(12,'ben','20036');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(13,'beng','20032');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(14,'bi','20026');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(15,'bian','20002');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(16,'biao','19990');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(17,'bie','19986');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(18,'bin','19982');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(19,'bing','19976');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(20,'bo','19805');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(21,'bu','19784');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(22,'ca','19775');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(23,'cai','19774');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(24,'can','19763');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(25,'cang','19756');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(26,'cao','19751');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(27,'ce','19746');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(28,'ceng','19741');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(29,'cha','19739');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(30,'chai','19728');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(31,'chan','19725');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(32,'chang','19715');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(33,'chao','19540');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(34,'che','19531');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(35,'chen','19525');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(36,'cheng','19515');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(37,'chi','19500');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(38,'chong','19484');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(39,'chou','19479');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(40,'chu','19467');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(41,'chuai','19289');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(42,'chuan','19288');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(43,'chuang','19281');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(44,'chui','19275');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(45,'chun','19270');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(46,'chuo','19263');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(47,'ci','19261');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(48,'cong','19249');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(49,'cou','19243');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(50,'cu','19242');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(51,'cuan','19238');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(52,'cui','19235');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(53,'cun','19227');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(54,'cuo','19224');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(55,'da','19218');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(56,'dai','19212');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(57,'dan','19038');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(58,'dang','19023');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(59,'dao','19018');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(60,'de','19006');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(61,'deng','19003');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(62,'di','18996');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(63,'dian','18977');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(64,'diao','18961');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(65,'die','18952');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(66,'ding','18783');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(67,'diu','18774');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(68,'dong','18773');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(69,'dou','18763');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(70,'du','18756');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(71,'duan','18741');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(72,'dui','18735');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(73,'dun','18731');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(74,'duo','18722');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(75,'e','18710');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(76,'en','18697');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(77,'er','18696');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(78,'fa','18526');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(79,'fan','18518');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(80,'fang','18501');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(81,'fei','18490');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(82,'fen','18478');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(83,'feng','18463');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(84,'fo','18448');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(85,'fou','18447');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(86,'fu','18446');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(87,'ga','18239');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(88,'gai','18237');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(89,'gan','18231');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(90,'gang','18220');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(91,'gao','18211');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(92,'ge','18201');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(93,'gei','18184');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(94,'gen','18183');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(95,'geng','18181');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(96,'gong','18012');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(97,'gou','17997');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(98,'gu','17988');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(99,'gua','17970');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(100,'guai','17964');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(101,'guan','17961');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(102,'guang','17950');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(103,'gui','17947');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(104,'gun','17931');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(105,'guo','17928');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(106,'ha','17922');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(107,'hai','17759');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(108,'han','17752');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(109,'hang','17733');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(110,'hao','17730');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(111,'he','17721');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(112,'hei','17703');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(113,'hen','17701');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(114,'heng','17697');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(115,'hong','17692');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(116,'hou','17683');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(117,'hu','17676');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(118,'hua','17496');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(119,'huai','17487');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(120,'huan','17482');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(121,'huang','17468');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(122,'hui','17454');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(123,'hun','17433');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(124,'huo','17427');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(125,'ji','17417');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(126,'jia','17202');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(127,'jian','17185');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(128,'jiang','16983');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(129,'jiao','16970');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(130,'jie','16942');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(131,'jin','16915');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(132,'jing','16733');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(133,'jiong','16708');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(134,'jiu','16706');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(135,'ju','16689');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(136,'juan','16664');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(137,'jue','16657');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(138,'jun','16647');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(139,'ka','16474');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(140,'kai','16470');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(141,'kan','16465');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(142,'kang','16459');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(143,'kao','16452');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(144,'ke','16448');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(145,'ken','16433');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(146,'keng','16429');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(147,'kong','16427');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(148,'kou','16423');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(149,'ku','16419');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(150,'kua','16412');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(151,'kuai','16407');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(152,'kuan','16403');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(153,'kuang','16401');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(154,'kui','16393');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(155,'kun','16220');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(156,'kuo','16216');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(157,'la','16212');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(158,'lai','16205');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(159,'lan','16202');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(160,'lang','16187');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(161,'lao','16180');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(162,'le','16171');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(163,'lei','16169');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(164,'leng','16158');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(165,'li','16155');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(166,'lia','15959');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(167,'lian','15958');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(168,'liang','15944');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(169,'liao','15933');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(170,'lie','15920');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(171,'lin','15915');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(172,'ling','15903');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(173,'liu','15889');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(174,'long','15878');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(175,'lou','15707');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(176,'lu','15701');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(177,'lv','15681');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(178,'luan','15667');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(179,'lue','15661');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(180,'lun','15659');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(181,'luo','15652');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(182,'ma','15640');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(183,'mai','15631');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(184,'man','15625');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(185,'mang','15454');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(186,'mao','15448');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(187,'me','15436');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(188,'mei','15435');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(189,'men','15419');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(190,'meng','15416');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(191,'mi','15408');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(192,'mian','15394');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(193,'miao','15385');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(194,'mie','15377');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(195,'min','15375');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(196,'ming','15369');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(197,'miu','15363');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(198,'mo','15362');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(199,'mou','15183');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(200,'mu','15180');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(201,'na','15165');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(202,'nai','15158');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(203,'nan','15153');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(204,'nang','15150');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(205,'nao','15149');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(206,'ne','15144');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(207,'nei','15143');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(208,'nen','15141');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(209,'neng','15140');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(210,'ni','15139');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(211,'nian','15128');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(212,'niang','15121');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(213,'niao','15119');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(214,'nie','15117');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(215,'nin','15110');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(216,'ning','15109');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(217,'niu','14941');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(218,'nong','14937');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(219,'nu','14933');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(220,'nv','14930');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(221,'nuan','14929');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(222,'nue','14928');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(223,'nuo','14926');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(224,'o','14922');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(225,'ou','14921');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(226,'pa','14914');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(227,'pai','14908');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(228,'pan','14902');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(229,'pang','14894');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(230,'pao','14889');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(231,'pei','14882');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(232,'pen','14873');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(233,'peng','14871');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(234,'pi','14857');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(235,'pian','14678');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(236,'piao','14674');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(237,'pie','14670');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(238,'pin','14668');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(239,'ping','14663');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(240,'po','14654');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(241,'pu','14645');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(242,'qi','14630');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(243,'qia','14594');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(244,'qian','14429');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(245,'qiang','14407');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(246,'qiao','14399');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(247,'qie','14384');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(248,'qin','14379');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(249,'qing','14368');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(250,'qiong','14355');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(251,'qiu','14353');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(252,'qu','14345');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(253,'quan','14170');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(254,'que','14159');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(255,'qun','14151');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(256,'ran','14149');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(257,'rang','14145');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(258,'rao','14140');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(259,'re','14137');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(260,'ren','14135');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(261,'reng','14125');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(262,'ri','14123');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(263,'rong','14122');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(264,'rou','14112');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(265,'ru','14109');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(266,'ruan','14099');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(267,'rui','14097');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(268,'run','14094');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(269,'ruo','14092');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(270,'sa','14090');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(271,'sai','14087');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(272,'san','14083');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(273,'sang','13917');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(274,'sao','13914');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(275,'se','13910');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(276,'sen','13907');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(277,'seng','13906');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(278,'sha','13905');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(279,'shai','13896');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(280,'shan','13894');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(281,'shang','13878');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(282,'shao','13870');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(283,'she','13859');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(284,'shen','13847');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(285,'sheng','13831');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(286,'shi','13658');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(287,'shou','13611');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(288,'shu','13601');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(289,'shua','13406');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(290,'shuai','13404');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(291,'shuan','13400');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(292,'shuang','13398');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(293,'shui','13395');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(294,'shun','13391');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(295,'shuo','13387');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(296,'si','13383');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(297,'song','13367');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(298,'sou','13359');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(299,'su','13356');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(300,'suan','13343');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(301,'sui','13340');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(302,'sun','13329');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(303,'suo','13326');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(304,'ta','13318');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(305,'tai','13147');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(306,'tan','13138');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(307,'tang','13120');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(308,'tao','13107');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(309,'te','13096');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(310,'teng','13095');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(311,'ti','13091');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(312,'tian','13076');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(313,'tiao','13068');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(314,'tie','13063');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(315,'ting','13060');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(316,'tong','12888');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(317,'tou','12875');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(318,'tu','12871');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(319,'tuan','12860');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(320,'tui','12858');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(321,'tun','12852');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(322,'tuo','12849');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(323,'wa','12838');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(324,'wai','12831');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(325,'wan','12829');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(326,'wang','12812');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(327,'wei','12802');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(328,'wen','12607');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(329,'weng','12597');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(330,'wo','12594');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(331,'wu','12585');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(332,'xi','12556');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(333,'xia','12359');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(334,'xian','12346');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(335,'xiang','12320');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(336,'xiao','12300');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(337,'xie','12120');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(338,'xin','12099');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(339,'xing','12089');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(340,'xiong','12074');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(341,'xiu','12067');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(342,'xu','12058');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(343,'xuan','12039');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(344,'xue','11867');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(345,'xun','11861');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(346,'ya','11847');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(347,'yan','11831');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(348,'yang','11798');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(349,'yao','11781');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(350,'ye','11604');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(351,'yi','11589');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(352,'yin','11536');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(353,'ying','11358');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(354,'yo','11340');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(355,'yong','11339');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(356,'you','11324');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(357,'yu','11303');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(358,'yuan','11097');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(359,'yue','11077');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(360,'yun','11067');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(361,'za','11055');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(362,'zai','11052');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(363,'zan','11045');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(364,'zang','11041');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(365,'zao','11038');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(366,'ze','11024');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(367,'zei','11020');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(368,'zen','11019');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(369,'zeng','11018');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(370,'zha','11014');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(371,'zhai','10838');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(372,'zhan','10832');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(373,'zhang','10815');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(374,'zhao','10800');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(375,'zhe','10790');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(376,'zhen','10780');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(377,'zheng','10764');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(378,'zhi','10587');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(379,'zhong','10544');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(380,'zhou','10533');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(381,'zhu','10519');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(382,'zhua','10331');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(383,'zhuai','10329');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(384,'zhuan','10328');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(385,'zhuang','10322');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(386,'zhui','10315');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(387,'zhun','10309');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(388,'zhuo','10307');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(389,'zi','10296');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(390,'zong','10281');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(391,'zou','10274');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(392,'zu','10270');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(393,'zuan','10262');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(394,'zui','10260');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(395,'zun','10256');
    INSERT INTO sys.pinyintable(id, pin_yin, code) VALUES(396,'zuo','10254');
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100
    • 101
    • 102
    • 103
    • 104
    • 105
    • 106
    • 107
    • 108
    • 109
    • 110
    • 111
    • 112
    • 113
    • 114
    • 115
    • 116
    • 117
    • 118
    • 119
    • 120
    • 121
    • 122
    • 123
    • 124
    • 125
    • 126
    • 127
    • 128
    • 129
    • 130
    • 131
    • 132
    • 133
    • 134
    • 135
    • 136
    • 137
    • 138
    • 139
    • 140
    • 141
    • 142
    • 143
    • 144
    • 145
    • 146
    • 147
    • 148
    • 149
    • 150
    • 151
    • 152
    • 153
    • 154
    • 155
    • 156
    • 157
    • 158
    • 159
    • 160
    • 161
    • 162
    • 163
    • 164
    • 165
    • 166
    • 167
    • 168
    • 169
    • 170
    • 171
    • 172
    • 173
    • 174
    • 175
    • 176
    • 177
    • 178
    • 179
    • 180
    • 181
    • 182
    • 183
    • 184
    • 185
    • 186
    • 187
    • 188
    • 189
    • 190
    • 191
    • 192
    • 193
    • 194
    • 195
    • 196
    • 197
    • 198
    • 199
    • 200
    • 201
    • 202
    • 203
    • 204
    • 205
    • 206
    • 207
    • 208
    • 209
    • 210
    • 211
    • 212
    • 213
    • 214
    • 215
    • 216
    • 217
    • 218
    • 219
    • 220
    • 221
    • 222
    • 223
    • 224
    • 225
    • 226
    • 227
    • 228
    • 229
    • 230
    • 231
    • 232
    • 233
    • 234
    • 235
    • 236
    • 237
    • 238
    • 239
    • 240
    • 241
    • 242
    • 243
    • 244
    • 245
    • 246
    • 247
    • 248
    • 249
    • 250
    • 251
    • 252
    • 253
    • 254
    • 255
    • 256
    • 257
    • 258
    • 259
    • 260
    • 261
    • 262
    • 263
    • 264
    • 265
    • 266
    • 267
    • 268
    • 269
    • 270
    • 271
    • 272
    • 273
    • 274
    • 275
    • 276
    • 277
    • 278
    • 279
    • 280
    • 281
    • 282
    • 283
    • 284
    • 285
    • 286
    • 287
    • 288
    • 289
    • 290
    • 291
    • 292
    • 293
    • 294
    • 295
    • 296
    • 297
    • 298
    • 299
    • 300
    • 301
    • 302
    • 303
    • 304
    • 305
    • 306
    • 307
    • 308
    • 309
    • 310
    • 311
    • 312
    • 313
    • 314
    • 315
    • 316
    • 317
    • 318
    • 319
    • 320
    • 321
    • 322
    • 323
    • 324
    • 325
    • 326
    • 327
    • 328
    • 329
    • 330
    • 331
    • 332
    • 333
    • 334
    • 335
    • 336
    • 337
    • 338
    • 339
    • 340
    • 341
    • 342
    • 343
    • 344
    • 345
    • 346
    • 347
    • 348
    • 349
    • 350
    • 351
    • 352
    • 353
    • 354
    • 355
    • 356
    • 357
    • 358
    • 359
    • 360
    • 361
    • 362
    • 363
    • 364
    • 365
    • 366
    • 367
    • 368
    • 369
    • 370
    • 371
    • 372
    • 373
    • 374
    • 375
    • 376
    • 377
    • 378
    • 379
    • 380
    • 381
    • 382
    • 383
    • 384
    • 385
    • 386
    • 387
    • 388
    • 389
    • 390
    • 391
    • 392
    • 393
    • 394
    • 395
    • 396

    3.创建函数

    Create Function sys.to_pinyin (NAME VARCHAR(255) CharSet gbk) RETURNS Varchar(255) CHARSet gbk
    Begin
      Declare mycode INT ; 
      Declare tmp_lcode Varchar(2) CHARSet gbk ;
      Declare lcode INT ; 
      Declare tmp_rcode Varchar(2) CHARSet gbk ;
      Declare rcode INT ; 
      Declare mypy Varchar(255) CHARSet gbk DEFAULT '' ; 
      Declare lp INT ;
     
      Set mycode = 0 ;
      Set lp = 1 ;
      Set NAME = HEX(NAME) ;
     
      While lp < LENGTH(NAME) DO
        Set tmp_lcode = SUBSTRING(NAME, lp, 2) ;
        Set lcode = CAST(ASCII(UNHEX(tmp_lcode)) AS UNSIGNED) ;
        Set tmp_rcode = SUBSTRING(NAME, lp + 2, 2) ;
        Set rcode = CAST(ASCII(UNHEX(tmp_rcode)) AS UNSIGNED) ;
     
        IF lcode > 128 THEN
          Set mycode = 65536 - lcode * 256 - rcode ; 
          Select CONCAT(mypy, pin_yin) Into mypy From sys.pinyintable Where code >= Abs(mycode) Order By code Asc Limit 1;
          Set lp = lp + 4 ;
        Else
          Set mypy = Concat(mypy,Char(Cast(Ascii(UNHEX(SUBSTRING(NAME, lp, 2))) AS UNSIGNED)));
          Set lp = lp + 2 ;
        End If;
      End While;
      Return Lower(mypy) ;
    End;
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    Select sys.to_pinyin("中国") From Dual;
    --结果
    zhongguo
    
    • 1
    • 2
    • 3
  • 相关阅读:
    pandas:时间序列数据的周期转换
    能跑通的mmdet3d版本
    Seata分布式事务简析
    目标检测——3D玩具数据集
    【计算机视觉40例】案例34:勾勒五官轮廓
    用MES系统预警监控
    把第三方jar引入到maven中
    java 企业工程管理系统软件源码 自主研发 工程行业适用
    Laravel9版本的CMS出现Invalid datetime format异常
    《合成孔径雷达成像算法与实现》Figure5.3
  • 原文地址:https://blog.csdn.net/wangshengfeng1986211/article/details/133787786