你的位置:首页 > 数据库

[数据库]导入表数据 txt


导入表数据 txt

 1 mysql> load data infile "D:/import.txt" into table shop;
输出: 2 Query OK, 5 rows affected (0.08 sec) 3 Records: 5 Deleted: 0 Skipped: 0 Warnings: 0 4 5 6 txt文档中内容: 7 6 bag 180 jd A 500 8 7 ipad air2 3500 tmall B 500 9 8 Sony Camera 1800 jd B 20010 9 knife 6 tmall A 50011 10 shoes 300 jd B 8012 13 14 导入后查询数据:15 mysql> select * from shop;
输出:16 +----+-------------+---------+---------------+------+-------+17 | id | name | price | supplier_name | sort | count |18 +----+-------------+---------+---------------+------+-------+19 | 1 | apple | 2.50 | dangdang | A | 500 |20 | 2 | book | 8.50 | tmall | B | 500 |21 | 3 | book | 1.20 | jd | B | 200 |22 | 4 | apple | 1.50 | tmall | A | 500 |23 | 5 | pen | 8.50 | jd | B | 80 |24 | 6 | bag | 180.00 | jd | A | 500 |25 | 7 | ipad air2 | 3500.00 | tmall | B | 500 |26 | 8 | Sony Camera | 1800.00 | jd | B | 200 |27 | 9 | knife | 6.00 | tmall | A | 500 |28 | 10 | shoes | 300.00 | jd | B | 80 |29 +----+-------------+---------+---------------+------+-------+30 10 rows in set (0.00 sec)