List:General Discussion« Previous MessageNext Message »
From:John McCaskey Date:March 31 2005 8:04pm
Subject:Re: How does a multi-row INSERT work?
View as plain text  
INSERT INTO table (field1, field2) VALUES (1, 2), (3, 4), (5, 6), (7,
8);

That would insert 4 rows first row with field1=1, field2=2, second
field1=3, field2=4, etc.

This is documented on the INSERT Syntax page of the manual, but it may
be kind of hard to read for a beginner as it just says VALUES({expr |
DEFAULT},...),(...),...

On Thu, 2005-03-31 at 11:46 -0800, Chris W. Parker wrote:
> 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.
> 
-- 
Thread
How does a multi-row INSERT work?Chris W. Parker31 Mar
  • Re: How does a multi-row INSERT work?Jonathan Wright31 Mar
  • Re: How does a multi-row INSERT work?Dan Nelson31 Mar
    • Re: How does a multi-row INSERT work?SGreen31 Mar
  • Re: How does a multi-row INSERT work?John McCaskey31 Mar
  • Re: How does a multi-row INSERT work?Rhino1 Apr
  • Re: How does a multi-row INSERT work?Gabriel PREDA1 Apr
RE: How does a multi-row INSERT work?Chris W. Parker31 Mar
Re: How does a multi-row INSERT work?beacker31 Mar