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

table: 

mysql中的Load data用法

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文件下载

mysql中的Load data用法

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

导入数据:

mysql中的Load data用法

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

 

应用mysql版本:

mysql中的Load data用法

 

 

相关文章:

  • 2021-11-26
  • 2022-01-14
  • 2021-04-21
  • 2022-12-23
  • 2021-10-03
猜你喜欢
  • 2021-08-01
  • 2022-12-23
  • 2022-12-23
  • 2021-10-04
  • 2022-12-23
  • 2022-12-23
  • 2021-09-24
相关资源
相似解决方案