0

I am trying to import data into mysql using

LOAD DATA INFILE "C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/coviddeaths.csv"
INTO TABLE coviddeaths
COLUMNS TERMINATED BY ','
OPTIONALLY ENCLOSED BY '"'
ESCAPED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 LINES;

I am getting error 1265 while importing data with this method at a column. The error says Error Code: 1265. Data truncated for column 'new_cases_smoothed' at row 1 This column in csv file has values ranging from -525 to 826374.286 . The column contains more than 10K unique values. Column contains null values, integers and decimals like the numbers stated above.

I tried setting the datatype as float as well as double but getting the same error every time. Data set is taken from https://ourworldindata.org/covid-deaths

I am still a newbie at data analytics so I don't know much so any help will be appreciated. Thanks in advance.

Dhiraj D
  • 21
  • 3
  • 1
    Can you add the DDL for the table `coviddeaths` to your question? (using [edit]) – Luuk Jun 06 '21 at 16:32
  • If will fail because on the first row the value for `new_cases_smoothed` is empty. How to import `NULL` values is answered here: https://stackoverflow.com/questions/2675323/mysql-load-null-values-from-csv-data – Luuk Jun 06 '21 at 17:19

0 Answers0