Skip to content

ENCLOSED BY

LOAD DATA INFILE 'path/to/your/csv'
INTO TABLE your_table
FIELDS TERMINATED BY ','
ENCLOSED BY '"'
LINES TERMINATED BY '\n';
Query OK, 20 rows affected (0.01 sec)
Records: 20 Deleted: 0 Skipped: 0 Warnings: 0

The above SQL code is loading data from a CSV file into a MySQL table. The ENCLOSED BY '"' keyword is used to indicate that the values inside the file are enclosed by double quotes. It ensures that these quoted values are treated as single entities even if they contain the field terminator character (in this case, a comma).