LINES

LINES is a reserved keyword in SQL, mainly used in conjunction with the LOAD DATA INFILE command. It specifies the starting and ending points for data record importing from a text file into a table. It helps SQL efficiently identify lines in the text file that constitute a single record within the table.

Example

CREATE TABLE example_table(
id INT AUTO_INCREMENT,
text VARCHAR(100),
PRIMARY KEY(id)
);
LOAD DATA LOCAL INFILE 'file.txt' INTO TABLE example_table
LINES TERMINATED BY '\n'
(text);

Output

Query OK, 3 rows affected (0.03 sec)

Explanation

This code creates a new table example_table with two columns id and text. Then it loads data from a local file 'file.txt'. Each line in the input file is considered as a new record. Therefore the LINES TERMINATED BY '\n' clause is used to indicate end of a record.

For in-depth explanations and examples SQL keywords where you write your SQL, install our extension.