List:General Discussion« Previous MessageNext Message »
From:Martijn Tonies Date:April 13 2007 10:09am
Subject:Re: Is it possible to either update or insert in a single query?
View as plain text  
> REPLACE is a MySQL extension to the SQL standard. It either inserts, or
> deletes and inserts. For another MySQL extension to standard SQL — that
> either inserts or updates — see Section 13.2.4.3, “INSERT ... ON
> DUPLICATE
> KEY UPDATE Syntax”.

Take note!!

If you're using triggers, foreign key constraints or defaults on columns, it
is
better to use ON DUPLICATE cause it will update instead of deleting the
row first.

Martijn Tonies
Database Workbench - development tool for MySQL, and more!
Upscene Productions
http://www.upscene.com
My thoughts:
http://blog.upscene.com/martijn/
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com

Thread
Is it possible to either update or insert in a single query?Douglas Pearson13 Apr
  • Re: Is it possible to either update or insert in a single query?Carlos Proal13 Apr
  • Re: Is it possible to either update or insert in a single query?Mogens Melander13 Apr
    • RE: Is it possible to either update or insert in a single query?Douglas Pearson13 Apr
  • RE: Is it possible to either update or insert in a single query?Randall Price13 Apr
Re: Is it possible to either update or insert in a single query?Martijn Tonies13 Apr