Home > Database > Mysql Tutorial > mysql中的Load data用法_MySQL

mysql中的Load data用法_MySQL

WBOY
Release: 2016-06-01 13:36:50
Original
1172 people have browsed it

bitsCN.com

测试把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)
Copy after login

 

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

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

导入数据:

View Code
load data local infile 'D:/data.txt' into table petlines terminated by '/r/n' ignore 1 lines;
Copy after login

 

应用mysql版本:

 

 

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template