emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Stefan Nobis <stefan-ml@snobis.de>
To: emacs-orgmode@gnu.org
Subject: Re: Finally figuring out some ob-sqlite stuff -- for worg?
Date: Sat, 09 Nov 2019 18:28:32 +0100	[thread overview]
Message-ID: <m1zhh5ari7.fsf@nobis-it.eu> (raw)
In-Reply-To: <87woc956zj.fsf@ericabrahamsen.net> (Eric Abrahamsen's message of "Sat, 09 Nov 2019 08:50:40 -0800")

Eric Abrahamsen <eric@ericabrahamsen.net> 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.

  reply	other threads:[~2019-11-09 17:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-08  0:10 Finally figuring out some ob-sqlite stuff -- for worg? Eric Abrahamsen
2019-11-08  6:59 ` Fraga, Eric
2019-11-09 16:50   ` Eric Abrahamsen
2019-11-09 17:28     ` Stefan Nobis [this message]
2019-11-09 17:58       ` Eric Abrahamsen
2019-11-10  9:44         ` Stefan Nobis
2019-11-10 19:48           ` Eric Abrahamsen
2019-11-10 19:48           ` Eric Abrahamsen
2020-02-12  9:15 ` Bastien
  -- strict thread matches above, loose matches on Subject: below --
2019-11-08  7:06 Thomas S. Dye
2019-11-08 16:20 ` Eric Abrahamsen
2019-11-09 17:38 Thomas S. Dye

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1zhh5ari7.fsf@nobis-it.eu \
    --to=stefan-ml@snobis.de \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).