ANY and ALL

18 views
Skip to first unread message

Roy Hann

unread,
Jun 30, 2022, 4:21:24 AMJun 30
to
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

nikosv

unread,
Jun 30, 2022, 4:58:56 PMJun 30
to
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

Roy Hann

unread,
Jul 1, 2022, 5:44:51 AMJul 1
to
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
Reply all
Reply to author
Forward
0 new messages