I have a requirement where I have to insert a lots of rows.For inserting we use like this
insert into emp(name,age) values('abc',12);
This will insert only one row.For inserting multiple rows we can either write insert query multiple times or write a single query with multiple values.For example
condtion1
insert into emp(name,age) values('abc1',121);
insert into emp(name,age) values('abc2',122);
insert into emp(name,age) values('abc3',12);
condition2
insert into emp(name,age) values('abc',12),('abc2',122),('abc3',12);
My question is are both (condition1 and condition2) above takes time?I guess condtion2 takes less time than condition2. If my guess is true then what is the reason for it?
Aucun commentaire:
Enregistrer un commentaire