Loading

Load Data Statement in MySQL

LOAD DATA and INSERT statements in MySQL are used for populating records into MySQL tables.
LOAD DATA populates record in bulk But INSERT statement populates record in a single row.
mysql> LOAD DATA LOCAL INFILE ‘path/staff.txt’ INTO TABLE employee;
if we created a file on windows editor, that uses \r \n as a line terminator. Then statement will be
MySQL. LOAD DATA LOCAL INFILE ‘path/staff.txt’ INTO TABLE employee LINES TERMINATED BY ‘\r\n’;
So, all the data of the staff.txt file will be populated on the employee table.
Since, we know the INSERT statement populates a single row. So, its statement will be.
mysql> INSERT INTO employee (‘name’, ‘age’, ‘designation’, ‘salary’) VALUES (‘Raj’, ’25’, ‘MD’, ‘50000’);

Share with:


One thought on “Load Data Statement in MySQL

Leave a Reply

Connect with:

z35W7z4v9z8w
Verified by ExactMetrics