tbledge.csv的格式是:749030,1,3,1mw_10er
数据库表tbledge
+---------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------+--------------+------+-----+---------+-------+
| id | int(11) | YES | | NULL | |
| source | int(11) | YES | | NULL | |
| destiny | int(11) | YES | | NULL | |
| graphid|varchar(255)| YES| | NULL | |
+---------+--------------+------+-----+---------+-------+
需要将逗号去除,并将相应字段转入到数据库表中,第一个字段对应id,第二个字段对应source,第三个字段对应destiny,第四个字段对应graphid,在mysql的命令行下,可以这么书写:
load data local infile 'tbledge.csv' into table tbledge fields terminated by ',' lines terminated by '\\n' (id,source,destiny,graphid);