From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Nobis Subject: Re: Finally figuring out some ob-sqlite stuff -- for worg? Date: Sat, 09 Nov 2019 18:28:32 +0100 Message-ID: References: <87bltn5it6.fsf@ericabrahamsen.net> <87d0e23lca.fsf@ucl.ac.uk> <87woc956zj.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:58078) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iTUXR-0000dL-13 for emacs-orgmode@gnu.org; Sat, 09 Nov 2019 12:28:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iTUXO-0004U9-53 for emacs-orgmode@gnu.org; Sat, 09 Nov 2019 12:28:40 -0500 Received: from basilikum.nobis-admin.de ([89.238.71.130]:58612) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1iTUXM-0004TN-Py for emacs-orgmode@gnu.org; Sat, 09 Nov 2019 12:28:37 -0500 Received: from bohne (p200300CD671DE500852FC36557338571.dip0.t-ipconnect.de [IPv6:2003:cd:671d:e500:852f:c365:5733:8571]) by basilikum.nobis-admin.de (Postfix) with ESMTPSA id D25CC7E0A0D for ; Sat, 9 Nov 2019 18:28:32 +0100 (CET) In-Reply-To: <87woc956zj.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sat, 09 Nov 2019 08:50:40 -0800") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org Eric Abrahamsen writes: > Okay, it's up. If anyone wants to explain to me the point of the > "where exists" clause in the SQL, I would be interested to hear. It > works as expected this way, but is that clause necessary? Yes, very necessary. Without it, all ratings would be changed - the two example rows without ratings (ids 5 and 12) would get the values from the intermediary org table, every other row in table bookreview would get its rating attribute set to null (because there is no matching entry in the temporary updates table). Remember: update without a where clause always touches every single row of the complete table. The "where exists" clause ensures that only those rows of bookreviews are touched that are present in the intermediary org table. If you do not like "where exists" you could say "where bookreview.id in (select id from udpates)". -- Until the next mail..., Stefan.