The LINES clause appears in MySQL and MariaDB within LOAD DATA INFILE and SELECT ... INTO OUTFILE statements. It tells the SQL engine how to recognize the start and end of each logical record in a text file.• STARTING BY lets you define a string that must appear at the beginning of every line. Records that do not match the prefix are ignored. This is handy for skipping headers or comments.• TERMINATED BY defines the sequence that marks the end of a line. The default is a Unix newline ('\n'), but you can set Windows style ('\r\n') or any custom delimiter.The clause only affects text—binary files ignore it. LINES works together with the FIELDS clause, which controls column delimiters inside each line. Using incorrect or mismatched settings will cause data misalignment or import errors. LINES is not part of the ANSI SQL standard and is unsupported by most other databases.
STARTING BY
(string) - Optional prefix that each line must begin with.TERMINATED BY
(string) - Optional sequence that ends each line.LOAD DATA, INTO OUTFILE, FIELDS, COPY (PostgreSQL), BULK INSERT
MySQL 3.23
It defines the character sequence that signals the end of each row when importing or exporting text files.
Combine IGNORE 1 LINES or use LINES STARTING BY with a prefix that only real data rows contain.
No. LINES is exclusive to MySQL and MariaDB. Other systems use COPY or BULK INSERT with different options.
MySQL defaults to the Unix newline character (\n).