Hi, Yes - REPLACE is just INSERT with the ability to pre-delete if a UNIQUE key clash is found. This means that you would have to specify all the columns (even if they already had values in them). Update will update records that match the where, changing only the specified columns.
HTH Quentin -----Original Message----- From: Martin MOKREJŠ [mailto:[EMAIL PROTECTED]] Sent: Wednesday, 14 November 2001 10:04 a.m. To: Gerald Clark Cc: [EMAIL PROTECTED] Subject: Re: Introducing hidden row having duplicated primary key On Tue, 13 Nov 2001, Gerald Clark wrote: > Looks correct to me. > What do you think is the problem? > > 2 rows were affected by the replace. > One row was deleted, and one was inserted, > Both rows had a value of 'test' for column 'Tab'. Cool, thanks to Jeremy Zawodny and you, now I know even more that I do not know sql. Well, I told you that. ;) I thought that REPLACE replaces only fields which are different, so if a line is missing, behaves as an insert, if the line is present, behaves as an updates on columns which differ. This means that I was hoping that UPDATE updates/rewrites all specified columns on line; REPLACE has some logic to figure out that we do not have to rewrite a column with the same data and so we do not have to recreate an index for such column. If I guess right, deleting a row means marking it as deleted, right, so the REPLACE in my case marked the old line/row deleted and appended a new row to the table? That would mean it's better to use UPDATE then REPLACE, right? ;) -- Martin Mokrejs - PGP5.0i key is at http://www.natur.cuni.cz/~mmokrejs MIPS / Institute for Bioinformatics <http://mips.gsf.de> GSF - National Research Center for Environment and Health Ingolstaedter Landstrasse 1, D-85764 Neuherberg, Germany tel.: +49-89-3187 3616 , fax: +49-89-3187 3585 --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php The information contained in this email is privileged and confidential and intended for the addressee only. If you are not the intended recipient, you are asked to respect that confidentiality and not disclose, copy or make use of its contents. If received in error you are asked to destroy this email and contact the sender immediately. Your assistance is appreciated. --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php