英汉字典(含音标)csv导入MySQL

2019/08/26 16:27
阅读数 12

创建数据表:

CREATE TABLE `tb_words_dict` (

  `id` int(11) NOT NULL AUTO_INCREMENT,

  `word` varchar(164) COLLATE utf8_bin NOT NULL,

  `sw` varchar(64) COLLATE utf8_bin NOT NULL,

  `phonetic` varchar(64) COLLATE utf8_bin DEFAULT NULL,

  `definition` text COLLATE utf8_bin,

  `translation` text COLLATE utf8_bin,

  `pos` varchar(16) COLLATE utf8_bin DEFAULT NULL,

  `collins` varchar(11) COLLATE utf8_bin DEFAULT '0',

  `oxford` varchar(11) COLLATE utf8_bin DEFAULT '0',

  `tag` varchar(64) COLLATE utf8_bin DEFAULT NULL,

  `bnc` varchar(11) COLLATE utf8_bin DEFAULT NULL,

  `frq` varchar(11) COLLATE utf8_bin DEFAULT NULL,

  `exchange` text COLLATE utf8_bin,

  `detail` text COLLATE utf8_bin,

  `audio` text COLLATE utf8_bin,

  PRIMARY KEY (`id`),

  UNIQUE KEY `唯一word` (`word`) USING BTREE,

  UNIQUE KEY `id` (`id`) USING BTREE

) ENGINE=InnoDB AUTO_INCREMENT=8359808 DEFAULT CHARSET=utf8 COLLATE=utf8_bin

导入数据库:

load data infile '/private/tmp/words_dict.csv' 

replace into table tb_words_dict 

fields terminated by ',' 

optionally enclosed by '"' 

lines terminated by '\n' 

ignore 1 lines(word,phonetic,definition,translation,pos,collins,oxford,tag,bnc,frq,exchange,detail,audio);

可以正常导入的字典链接: https://github.com/github-jinwei/English-Chinese-dictionary-CSV.git

展开阅读全文
打赏
0
0 收藏
分享
加载中
更多评论
打赏
0 评论
0 收藏
0
分享
返回顶部
顶部