There are two forms of multi-row insert. Here is a script that illustrates
both:
----------------------------------------------------------------------------
------------
use tmp;

drop table if exists target;
create table if not exists target
(id smallint not null,
 name char(10) not null,
 primary key(id));

insert into target
(id, name)
select empno, lastname
from Sample.Employee
where workdept = 'D21';

select * from target;

insert into target (id, name) values
(500, 'Smith'),
(600, 'Jones');

select * from target;

----------------------------------------------------------------------------
------------

The first insert statement copies specified rows and columns from another
table into 'target'. The second insert statement creates multiple new rows
in the 'target' table from scratch.

Rhino

----- Original Message ----- 
From: "Chris W. Parker" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
Sent: Thursday, March 31, 2005 2:46 PM
Subject: How does a multi-row INSERT work?


Hello,

I searched the archives, looked through the manual, and searched google
for info on how to actually perform a multi-row INSERT but didn't find
an answer.

Would someone please show me the syntax for this please?

I could just do a loop and INSERT the data that way but according to the
manual, a multi-row INSERT is faster.



Thanks,
Chris.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]


-- 
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.3 - Release Date: 25/03/2005




-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.8.3 - Release Date: 25/03/2005


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to