This article will discuss how to insert multiple rows in a MySQL table. Let us get started by making the sample data. We will be creating a table named employee_details.

 CREATE TABLE employee_details(
  emp_id int ,
  emp_enroll_no varchar(255) NOT NULL,
  emp_city varchar(255) DEFAULT NULL,
  emp_firstName varchar(255) DEFAULT NULL,
  emp_lastName varchar(255) DEFAULT NULL,
  primary key(emp_id)

Action Output:-


We will now insert multiple rows into the employee_details table but let us first look into the syntax.


INSERT INTO name_of_your_table (column1, column2, ....) 
(value1, value2 , ....), 
(value1, value2 , ....), 
(value1, value2 , ....), 
(value1, value2 , ....);
  • name_of_your_table: is the table for inserting the rows.
  • column1, column2, …. : is the column list of the table.
  • value1, value2 , …. : are the values to be inserted into columns.
  • Different rows are separated by  ‘ , ‘ and the last row is terminated by a ‘ ; ‘

Query to insert multiple rows into the employee_details table

 INSERT INTO employee_details (emp_id, emp_enroll_no, emp_city, emp_firstName, emp_lastName) 
 (5,"5-N","New York","Harsh","Garcia"),
 (6,"6-N","New York","William","Jones"),
 (9,"9-N","New York","Pualou","Miller"),
 (10,"6-N","San Francisco","William","Jones");

Action Output:-


Ten rows got inserted successfully, as shown in image_2.

Let us take a glance at the table employee_details’ data.

SELECT * FROM employee_details;



Multiple rows are now inserted into the employee_details table in a single MySQL query.


We hope this article helped you with inserting multiple rows in a MySQL table. Good Luck !!!