0

I'm learning the basics of SQL and I have to import data from a csv file to my test_database in MySQL but I keep getting the error Data truncated for column 'id' at row 1.

Here is my SQL Query

CREATE TABLE practice_table(
    id INT PRIMARY KEY,
    name VARCHAR(20),
    points DECIMAL,
    rebounds DECIMAL,
    assists DECIMAL,
    minutes DECIMAL,
    def_rebounds DECIMAL,
    off_rebounds DECIMAL,   
    blocks DECIMAL,
    steals DECIMAL,
    turnovers DECIMAL,
);

LOAD DATA INFILE 'C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/test_database.csv'
INTO TABLE practice_table
IGNORE 1 LINES;

Also added is a screenshot of my csv document.

Help would be appreciated. Thank you.

E. Artemis
  • 47
  • 6
  • Check the first answer in the linked question and try adding the extra command after `INTO TABLE xxxx ` but you don't need to add the `(col1, col2 ...` command at the end. That should fix your problem. – FanoFN Jul 27 '21 at 00:55

0 Answers0