mysql中的Load data用法

测试把txt文件导入至mysql数据库中:

table: 

View Code
CREATE TABLE `pet` (
`name` varchar(20) DEFAULT NULL,
`owner` varchar(20) DEFAULT NULL,
`species` varchar(20) DEFAULT NULL,
`sex` char(1) DEFAULT NULL,
`birth` date DEFAULT NULL,
`death` date DEFAULT NULL
)

 

txt文件:D:/data.txt (txt文件下载

txt中使用 '\N' 描述null值。

导入数据:

View Code
load data local infile 'D:/data.txt' into table pet
lines terminated by '\r\n' ignore 1 lines;

 

应用mysql版本:

 

 

posted @ 2013-01-12 18:32  ok_008  阅读(1185)  评论(0编辑  收藏  举报
给我写信