How to Insert Multiple Rows in Mysql with example

You want to add multiple data/value/row in single time than follow this syntax


INSERT INTO table_name (col_name1, col_name2,...col_namen) VALUES (col_name1_data1,col_name2_data1,....col_namen_data1),(col_name1_data2,col_name2_data2,....col_namen_data2),....(col_name1_datan,col_name2_datan,....col_namen_datan);


# Any number of row can be added.
# Order of data/values must match order of column name.


Here we adding 3 row to homedetails table

INSERT INTO homedetails (homeno,homename,state,country) VALUES(206,"chiguru",”karnataka”,”india”),(20,"guru",”kerala”,”india”),(28,"krish",”goa”,”india”);

homeno homename state country
206 chiguru karnataka india
20 guru kerala india
28 krish goa India

Previous Code:-
Update data in tables

List Code:-
Mysql Codes

Next Code:-
Delete row

Leave reply

Add your comments here

Back to Top