On 27 May 2014, at 9:12pm, Drago, William @ MWG - NARDAEAST <william.dr...@l-3com.com> wrote:
> Let me rephrase the question by asking, how should I overwrite existing data? > For example, Jane has 5 guitars in her instrument table. She trades her 5 > guitars for 5 new ones. Almost everything about the new guitars is different > from the old guitars. > > My gut tells me I should simply delete where instrument_type = 'guitar' and > then insert the new data. Go with your gut. Since there's no relationship between the old and new guitars it would be just as likely that Jane would replace 5 guitars with 4 guitars, having sold two cheap ones and bought one expensive one. You should not be using REPLACE, you should be using DELETE, then INSERT, with the correct number of each type of command. Of course, unless your entire databases is about Jane's guitars that's not a good table to create. You would be more likely to have a database about everything Jane owns, or a database about all the guitars lots of people owns. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users