我是一个新的SQL学习者,并且在尝试将CSV文件导入MySQL Workbench时遇到问题。
CSV文件具有541909行,但是当将其导入MySQL时,仅导入大约35000行,我使用Count命令知道数字差异。
在导入过程中没有显示错误,在首选项设置中,我什至更改为1000000限制行。我正在使用MacBook。
以下是我的表查询并链接到我的CSV文件
(原始文件是xlsx,但我将其更改为CSV文件)
cdv的链接
但它仅导入500,000多行中的76318行。这就是为什么我被困。这是CSV链接文档
。先感谢您。
SQL查询:
CREATE TABLE Online_Retail (
InvoiceNo VARCHAR(100),
Stock_Code VARCHAR(50),
Description TEXT,
Quantity DECIMAL,
Invoice_Date DATE,
Unit_Price DECIMAL,
Customer_ID VARCHAR(50),
Country VARCHAR(100)
);
I’m a new SQL learner and I’m having problems while trying to import CSV file into MySQL Workbench.
The CSV file has 541909 Rows but when it is imported into MySQL, only around 35000 rows are imported and I knew the number difference by using the COUNT command.
No error is shown during the import process and I even changed to 1000000 limit rows in the preference setting. I’m using MacBook.
Below is my table query and link to my CSV file
https://archive.ics.uci.edu/ml/machine-learning-databases/00352/
(Original file is xlsx but I changed it to a CSV file)
Link for the cdv is
https://docs.google.com/spreadsheets/d/1EyZ9JrlsXcAxQz5BdAXTDVYjSLy25ZWOE1fpv0jDjxM/edit?usp=sharing
yet it only imports 76318 rows out of over 500,000 rows. That's why I am stuck. Here is csv link docs.google.com/spreadsheets/d/
Any idea of resolving this issue is highly appreciated. Thank you in advance.
SQL query:
CREATE TABLE Online_Retail (
InvoiceNo VARCHAR(100),
Stock_Code VARCHAR(50),
Description TEXT,
Quantity DECIMAL,
Invoice_Date DATE,
Unit_Price DECIMAL,
Customer_ID VARCHAR(50),
Country VARCHAR(100)
);
发布评论
评论(1)
向其他面临问题的人发布答案。我不建议使用MySQL Workbench导入向导,它不会说明错误。我尝试删除逗号,任何空间,但没有解决问题。
最简单的方法是
Posting the answer late for others facing the problem. I would not suggest to use the MYSQL workbench import wizard, it doesn't tell the errors. I tried removing commas, any spaces but didn't solve the problem.
The easiest way is
Convert CSV to .sql file using any online convertor like convertcsv.com (For convertcsv.com enter table name, ignore output options, keep all default options checked). Finally do a quick check on Step 4: Generate output to see if it is inserting into the right table)
Import using command line mysql -u -p < filename.sql