MySQL – Insert Multiple Rows into Table using Single INSERT

To insert multiple rows into a table using a single SQL INSERT statement in MySQL, specify the rows as comma separated values in INSERT statement.

In this tutorial, we will learn the syntax of SQL INSERT statement to insert multiple rows into MySQL Table, with examples.

Syntax – Insert Multiple Rows into Table

The following is a simple syntax of INSERT statement to insert multiple rows into table with two columns, in a single statement.

INSERT INTO table_name (column_1_name, column_2_name)
	VALUES ROW(column_1_value, column_2_value),
		ROW(column_1_value, column_2_value),
		ROW(column_1_value, column_2_value);

where

  • table_name is the table name into which we insert the row/record.
  • column_1_name, column_2_name, etc., are the names of columns present in the table.
  • column_1_value, column_2_value, etc., are the values in the record for the respective columns.

If there are more columns in the table, specify the column names and corresponding values in the query.

ADVERTISEMENT

Example

In the following example, we will consider a table students and insert three rows into this table using a single INSERT statement.

SQL Query

INSERT INTO students (name, rollno)
	VALUES ROW('Arjun', 14), ROW('Manish', 15), ROW('Vina', 16);

“students” Table

name	rollno
Arjun	14
Manish	15
Vina	16