Insert Multiple rows into Mysql

How to insert multiple rows into MySQL database table?


Multiple Rows :

We can insert multiple rows into MySQL table using a single INSERT statement.

Syntax :

INSERT INTO tbl_name(col_name1, col_name2,...) VALUES(expr1, expr2,.....;), (expr1a, expr2a,.....;)

Example :

mysql> insert into student(studid,name,marks,address,phone) values(3,'michael',75,'edinburgh',2598234), (4,'jack',82,'victoria street',2436821), (5,'anne',100,'downing street',2634821);
Query OK, 3 rows affected (0.00 sec) Records: 3 Duplicates: 0 Warnings: 0
This query will be useful while inserting large amount of data into a specific table.

Ask Questions

Ask Question