If you are trying to import a CSV file with a header using the LOAD command, you can use the IGNORE keyword to skip the first line of the file. Here’s an example:
basket random
LOAD DATA INFILE 'filename.csv'
INTO TABLE tablename
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 ROWS;
The IGNORE 1 ROWS statement tells MySQL to skip the first row of the file, which is the header. This will allow you to import the data from the CSV file without including the header row.
Many thanks for that solution. basket random
LOAD DATA INFILE 'filename.csv'
INTO TABLE tablename
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n'
IGNORE 1 ROWS;
The IGNORE 1 ROWS statement tells MySQL to skip the first row of the file, which is the header. This will allow you to import the data from the CSV file without including the header row.
Regard,
Clifton Evans