1500字范文,内容丰富有趣,写作好帮手!
1500字范文 > mysql从文本导入表_[Mysql] 用load data将文本文件数据导入到表

mysql从文本导入表_[Mysql] 用load data将文本文件数据导入到表

时间:2023-04-17 17:15:17

相关推荐

mysql从文本导入表_[Mysql] 用load data将文本文件数据导入到表

MySQL的load data命令可以将文本文件的数据导入到表

有文本文件如下:

E:\>more test.txt

1,XX,M

2,YY,F

在mysql里创建表t

mysql> create table t(id int,name varchar(10),sex varchar(1));

Query OK, 0 rows affected (0.62 sec)

mysql> load data infile 'e:\\test.txt' into table t fields terminated by ',';

Query OK, 2 rows affected, 2 warnings (0.10 sec)

Records: 2 Deleted: 0 Skipped: 0 Warnings: 2

mysql> select * from t;

++++

| id | name | sex |

++++

| 1 | XX | M |

| 2 | YY | F |

++++

2 rows in set (0.05 sec)

另外,mysqlimport 也可以将文本文件导入到表

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。