码迷,mamicode.com
首页 > 数据库 > 详细

英汉单词(含音标)csv导入MySQL

时间:2019-08-26 16:54:00      阅读:228      评论:0      收藏:0      [点我收藏+]

标签:file   sed   word   单词   rem   数据库   bsp   btree   har   

创建数据表:

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);

可以正常导入的字典链接:

英汉单词(含音标)csv导入MySQL

标签:file   sed   word   单词   rem   数据库   bsp   btree   har   

原文地址:https://www.cnblogs.com/akiha/p/11413318.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!