2,278 views
8 8 votes

Hi Guys,

In SQL, 

<condition> ALL  evaluates to TRUE if inner query returns no tuples. { X < ALL (empty) == TRUE }

<condition> ANY evaluates to FALSE if inner query returns no tuples. { X < ANY (empty) == FALSE }

But what is the logical reason behind this ?

PS:

ping @Krish__,  @Anu007,  @Ashwin Kulkarni @reena_kandari  and @srestha ji.

1 Answer

Best answer
16 16 votes

Assume that you are given "For every x∈S, property P(x) holds". You can say that the statement is false only if you can produce an element x such that the property is not satisfied. But, there exists no such x to claim that. Hence "ALL  evaluates to TRUE if inner query returns no tuples".

Now similarly you are given "There exists x∈S such that property P(x) holds". Now this statement can only be asserted to be true when you can pick up an element x to show that this property is indeed satisfied. But since there is no such element "ANY evaluates to FALSE if inner query returns no tuples".

• selected by
Position:
Show:

Related questions

0 0 votes
0 0 answers
476
476 views
soumayan bandhu asked Dec 22, 2017
476 views
How to solve SQL problems related to subqueries quickly?Though I have concepts still I face some difficulties in solving this problems
0 0 votes
0 0 answers
218
218 views
js__ asked Nov 24, 2025
218 views
Should we answer according to the latest version which is in real life practical or stick to the old versions in standard text books ? @Deepak Poonia @Sachin Mittal 1 Que...
0 0 votes
1 1 answer
340
340 views
Wren Oswin asked May 22, 2025
340 views
SQL
Table 1T1AT1Baaabbbccc  Table 2T2AT2BT2CaaabanullHow many tuples would the below...
1 1 vote
1 answers 1 answer
1.2k
1.2k views
tishhaagrawal asked Dec 16, 2023
1,207 views
My doubt here is, if NOT EXISTS gets an empty set as the input then every tuple of the table in the outer query must satisfy the condition. Am I right?For example, in the...