
load data infile 'CSV文件存放路径'
into table 表名
fields terminated by ',' optionally enclosed by '"' escaped by '"'
lines terminated by '\r\n'
或者打开csv文件 用excel内置函数拼接 insert into 语句
由于工作需要,经常需要将mysql数据库中的数据导出到excel表格,或者需要将excel表格数据导入到mysql数据库,我的方法是先将它们都转换成一种中间数据格式csv(execl数据可以直接导出为csv格式,csv格式也可以直接用excel打开)。下面介绍一下 *** 作步骤:csv导入mysql
load data infile 'C:\\Users\\UserName\\Desktop\\test.csv'
into table `table`
fields terminated by ',' optionally enclosed by '"' escaped by '"'
lines terminated by '\n'
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)