Re: [sqlite] DELETE & INSERT vs. REPLACE

2014-05-29 Thread Nico Williams
On May 29, 2014 4:59 PM, "J Decker" wrote: > If you have constraints between your tables (like cascade on delete) then > deleting a guitar entry would remove its related entirs in other tables > referencing that same ID. That's what deferred foreign key constraints are for,

Re: [sqlite] DELETE & INSERT vs. REPLACE

2014-05-29 Thread J Decker
> > > Can someone tell me what an appropriate use for REPLACE is? > > Replace might be used if you had a user_permission_info table, and were editing things about the user like maybe lastname/staffID ... password... but then with replace you MUST reference all unique keys...but basicallly the user

Re: [sqlite] DELETE & INSERT vs. REPLACE

2014-05-29 Thread Nico Williams
I tend to use an UPDATE ... WHERE EXISTS ...; followed by an INSERT ... WHERE NOT EXISTS ...;, which gives me insert or update semantics. Nico -- ___ sqlite-users mailing list sqlite-users@sqlite.org

Re: [sqlite] DELETE & INSERT vs. REPLACE

2014-05-29 Thread Sylvain Pointeau
I second "Petite Abeille", the merge into (SQL 2003) would be more than useful. REPLACE should be avoided. On Wed, May 28, 2014 at 5:08 PM, Simon Slavin wrote: > > On 28 May 2014, at 3:55pm, Drago, William @ MWG - NARDAEAST > wrote: > > > Can

Re: [sqlite] DELETE & INSERT vs. REPLACE

2014-05-28 Thread Simon Slavin
On 28 May 2014, at 3:55pm, Drago, William @ MWG - NARDAEAST wrote: > Can someone tell me what an appropriate use for REPLACE is? REPLACE in SQlite is just a way of writing INSERT OR REPLACE ... It's best use is when you are not sure whether a record already exists

Re: [sqlite] DELETE & INSERT vs. REPLACE

2014-05-28 Thread Drago, William @ MWG - NARDAEAST
> -Original Message- > From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of Simon Slavin > Sent: Tuesday, May 27, 2014 5:21 PM > To: General Discussion of SQLite Database > Subject: Re: [sqlite] DELETE & INSERT vs. REPLAC

Re: [sqlite] DELETE & INSERT vs. REPLACE

2014-05-27 Thread Simon Slavin
On 27 May 2014, at 9:12pm, Drago, William @ MWG - NARDAEAST 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

Re: [sqlite] DELETE & INSERT vs. REPLACE

2014-05-27 Thread Drago, William @ MWG - NARDAEAST
gt; To: General Discussion of SQLite Database > Subject: Re: [sqlite] DELETE & INSERT vs. REPLACE > > > On May 27, 2014, at 8:11 PM, Drago, William @ MWG - NARDAEAST > <william.dr...@l-3com.com> wrote: > > > Is there any difference between using REPLACE as opposed to delet

Re: [sqlite] DELETE & INSERT vs. REPLACE

2014-05-27 Thread Drago, William @ MWG - NARDAEAST
> -Original Message- > From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- > boun...@sqlite.org] On Behalf Of Richard Hipp > Sent: Tuesday, May 27, 2014 2:15 PM > To: General Discussion of SQLite Database > Subject: Re: [sqlite] DELETE & INSERT vs. REPLACE &g

Re: [sqlite] DELETE & INSERT vs. REPLACE

2014-05-27 Thread Petite Abeille
On May 27, 2014, at 8:11 PM, Drago, William @ MWG - NARDAEAST wrote: > Is there any difference between using REPLACE as opposed to deleting records > and then inserting new ones to take their place? Same difference. For example: create table foo ( id integer

Re: [sqlite] DELETE & INSERT vs. REPLACE

2014-05-27 Thread Richard Hipp
On Tue, May 27, 2014 at 2:11 PM, Drago, William @ MWG - NARDAEAST < william.dr...@l-3com.com> wrote: > All, > > Is there any difference between using REPLACE as opposed to deleting > records and then inserting new ones to take their place? > REPLACE only deletes records when it is absolutely

[sqlite] DELETE & INSERT vs. REPLACE

2014-05-27 Thread Drago, William @ MWG - NARDAEAST
All, Is there any difference between using REPLACE as opposed to deleting records and then inserting new ones to take their place? Thanks, -- Bill Drago Senior Engineer L3 Communications / Narda Microwave East 435 Moreland Road Hauppauge, NY 11788 631-272-5947 /