I have data as follows in my csv:
ID, NAME, fav_digit
1 abc 2
2 xyz
3 pqr 7
Now, I have created the table in the MySQL table using the data types Int, Varchar(7), Int
respectively.
But the table has populated 0
in the row where id = 2
This means that the fav_diigit is unintentionally representing 0
, but in reality, the data is not present. Is it that we can’t populate NULL
in an INT column?
I need to indicate that the cell is empty rather than a digit like 0
I was expecting NULL value in second row.BTW, I have connected my file from excel to MySQL using this command/query:
LOAD DATA LOCAL INFILE 'C:Userspathtofilefile.csv'
INTO TABLE file_data
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY 'n'
IGNORE 1 LINES
(id, Name, fav_digit);