Home > Database > Mysql Tutorial > body text

lines-在mysql 中怎么把文件里的内容写到表中啊!!!!!

WBOY
Release: 2016-06-06 09:36:56
Original
1204 people have browsed it

mysqllines

文本内容

1,"zhangsan","f"
2,"lisi","m"
3,"zhaoliu","f"
建表
create table mytable(
id int(20),
name varchar(20),
gender char(1)
);
把文本内容写到表中
load data infile 'f:b.txt' replace into table mytable
fields terminated by ',' enclosed by '"'
lines terminated by '\n'(id,name,gender);

mysql> load data infile 'f:b.txt' replace into table mytable
-> fields terminated by ',' enclosed by '"'
-> lines terminated by '\n'(id,name,gender);
ERROR 1406 (22001): Data too long for column 'gender' at row 1
怎么把文件里的内容写到表中啊!!!!!

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!