Can somebody please help me understand what is
ESCAPED BY clause means in
LOAD DATA LOCAL INFILE statement MySQL 5.5. I am a newbie to MySQL so please bear with me.
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
Generally the defaults cause LOAD DATA INFILE to act as follows when reading input:
Look for line boundaries at newlines.
Write tabs between fields.
For Further Details Please Have a Look at following Link :- dev.mysql.com/doc/refman/5.1/en/load-data.html
For input, if the FIELDS ESCAPED BY character is not empty, occurrences of that character are stripped and the following character is taken literally as part of a field value. Some two-character sequences that are exceptions, where the first character is the escape character. These sequences are shown in the following table (using “\” for the escape character). The rules for NULL handling are described later in this section.
Character Escape Sequence
\0 An ASCII NUL (0x00) character
If FIELDS ESCAPED BY is empty, a field value that contains an occurrence of FIELDS ENCLOSED BY or LINES TERMINATED BY followed by the FIELDS TERMINATED BY value causes LOAD DATA INFILE to stop reading a field or line too early. This happens because LOAD DATA INFILE cannot properly determine where the field or line value ends.
Basically Escaped by is used to escape the column on the basis of charachters appearing in data if it's not required