LIMIT on INSERT - necessary with unique keys?
Posted by: Bradley Cater
Date: September 10, 2009 06:35AM

Suppose we perform a query like

INSERT INTO my_table (`my_field0`, `my_field1`) VALUES ('my_value0', 'my_value1')
WHERE my_field2 = my_value2 LIMIT 1;

If my_field2 is a UNIQUE field (in my case, an auto-increment field like an id), is the LIMIT statement necessary, or will MySQL know that the first matching row that it finds is the only possible row?

Options: ReplyQuote


Subject
Views
Written By
Posted
LIMIT on INSERT - necessary with unique keys?
4774
September 10, 2009 06:35AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.