• ANY and ALL

    From Roy Hann@21:1/5 to All on Thu Jun 30 08:21:21 2022
    I have never been able to come up with a good example showing the
    ANY/ALL construct is a clearer alternative to something else, nor
    an example of a query that can be done only using them.

    A bit of googling has turned up a lot of unimaginative examples that
    seem just to illustrate the syntax (plus a distressing number of
    examples that flat-out don't do what they claim to do).

    Rick van der Lans' _SQL Guide to Ingres_ manages some plausible examples
    but nothing that isn't more easily and clearly done another way (IMO).

    Can anyone suggest some interesting examples?

    I have a hazy intuition there may be some interesting queries that
    depend on a subquery that returns no rows to ANY/ALL, but I can't bring
    one into focus...

    Roy

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From nikosv@21:1/5 to All on Thu Jun 30 13:58:53 2022
    I don't know if it is interesting,but I've once used ANY to remove duplicate rows

    https://www.i-programmer.info/programming/database/8296-sql-workshop-removing-duplicate-rows-.html

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Roy Hann@21:1/5 to nikosv on Fri Jul 1 09:44:49 2022
    nikosv wrote:

    I don't know if it is interesting,but I've once used ANY to remove duplicate rows

    https://www.i-programmer.info/programming/database/8296-sql-workshop-removing-duplicate-rows-.html

    Thank you Nikos.

    You walk very patiently through what is not a very intuitive bit of SQL.
    If someone can get their head around that they understand a lot.

    I also applaud your goal of encouraging set-wise processing instead of row-by-agonizing-row procedural code! :-)

    If anyone else has any very apt or concise examples where ANY/ALL make
    life easier I'm still keen to see them.

    Roy

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)