mysql ignore 1 lines_csv批量导入mysql命令

  • Post author:
  • Post category:mysql


今天把从Kaggle上下载下来的csv数据导入mysql,想做个统计分析,怎奈csv文件有些大,所以只能用mysql 命令导入,现mark下,以备以后不时之需:

1. 导入:

基本语法:

load data [low_priority] [local] infile ‘file_name txt’ [replace | ignore]

into table tbl_name

[character set gbk]

[fields

[terminated by’t’]

[OPTIONALLY] enclosed by ”]

[escaped by” ]]

[lines terminated by’n’]

[ignore number lines]

[(col_name, )]

导入命令_example:

load data infile ‘csv文件路径test.csv’

replace into table 表名

fields terminated by ‘,’

optionally enclosed by ‘”‘

lines terminated by ‘n’

ignore 1 lines(Id,@dummy,DayOfWeek,PdDistrict,Address,X,Y);

不要小看这个简单的example,包含了很多东西;

第一行就是导入文件;

第二行参看语法就会发现有两个词



版权声明:本文为weixin_35897853原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。