Heim  >  Artikel  >  Datenbank  >  load data infile将excel文件中的数百万条数据在1分钟内导入数据_MySQL

load data infile将excel文件中的数百万条数据在1分钟内导入数据_MySQL

WBOY
WBOYOriginal
2016-06-01 13:30:391212Durchsuche

bitsCN.com

load data infile将excel文件中的数百万条数据在1分钟内导入数据库

 

在MYSQL里面,使用load data infile 命令就可以了。

步骤很简单 1、先将excel另存为csv格式的文本,csv是以逗号分隔各个字段数据的

 

     2、在mysql中输入sql语句

load data local infile "F:/top20/top20W.csv" into table top20 fields terminated by ','   (dir_1,dir_2,dir_3,keyword,buy,click,ppc)  ;

 

然后执行SQL即可~

 

注意,字段必须放到fields terminated by ',' 的后面,否则会报错。

上面的fields terminated by ',' 的意思是根据文本中的逗号来分隔每个字段的数据。

 

如果文本里面的分隔符是/t制表位,则不需要写这个字段分隔SQL语句,直接写录入的字段即可。

 

剩下的就很简单了,大家一看就懂~

 

bitsCN.com
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn