来自txt文件的只有一条记录被加载到表中

时间:2017-11-03 21:01:51

标签: mysql

我有一个txt文件,其中的记录如下所示:

1194    8710    2009-01-04  Critical    42  151.35  0.07    Express Air 8.33    3.71    1.93    Tamara Dahlen   Ontario Ontario Corporate   Office Supplies Paper   """While you Were Out"" Message Book, One Form per Page"    Wrap Bag    0.35    2009-01-06  
2272    16326   2010-05-10  High    39  147.46  0.06    Regular Air 14.13   3.71    1.93    Bill Donatelli  Ontario Ontario Corporate   Office Supplies Paper   """While you Were Out"" Message Book, One Form per Page"    Wrap Bag    0.35    2010-05-10  
8376    59815   2010-12-15  Not Specified   14  51.56   0.09    Regular Air -1.06   3.71    1.93    Christy Brittain    British Columbia    West    Consumer    Office Supplies Paper   """While you Were Out"" Message Book, One Form per Page"    Wrap Bag    0.35    2010-12-17  
8179    58470   2011-06-08  High    13  49.08   0.06    Regular Air -0.31   3.71    1.93    Barry Blumstein British Columbia    West    Small Business  Office Supplies Paper   """While you Were Out"" Message Book, One Form per Page"    Wrap Bag    0.35    2011-06-08  
7100    50657   2011-12-18  High    16  60.02   0.1 Express Air 0.94    3.71    1.93    Aleksandra Gannaway New Brunswick   Atlantic    Corporate   Office Supplies Paper   """While you Were Out"" Message Book, One Form per Page"    Wrap Bag    0.35    2011-12-20  

我想将此文件加载到我创建的表中(该表不包含记录的所有字段)。但是,只加载了一条记录。我该如何解决?

CREATE DATABASE superstore;
SHOW DATABASES;

DROP TABLE IF EXISTS superstore.orders;

CREATE TABLE superstore.orders(
OrderID int,
ProductID   int,
OrderDate   date,
OrderPriority   varchar(20),
OrderQuantity   int,
Sales   decimal(15, 5),
Discount    decimal(3, 2),
ShipMode    varchar(20),
Profit  decimal(15, 2),
UnitPrice   decimal(15, 2),
ShippingCost    decimal(15, 2)
);

LOAD DATA LOCAL INFILE '/Users/gz/wcd/WCD-Toolbox-B5-SQL/data/superstore/orders.txt'
INTO TABLE superstore.orders
FIELDS TERMINATED BY '\t'
LINES TERMINATED BY '\n'
(OrderID, ProductID, OrderDate, OrderPriority, OrderQuantity, Sales, Discount, ShipMode, Profit, UnitPrice, ShippingCost);

SELECT * FROM superstore.orders LIMIT 5;

0 个答案:

没有答案