SQL & Queries

Answer & solution
Official answer: 7.0
Our answer: 7
1. The Spain subquery returns no rows. A comparison quantified by ALL over an empty set is true, because there is no counterexample. Hence the first predicate eliminates none of the outer rows.
2. The Germany subquery returns goals 16,14,11,10,10. The >ANY condition requires exceeding at least one of them, so with these non-NULL values it is equivalent to goals>10, not goals>16.
3. Seven rows have goal counts above 10: 16,15,14,13,12,11,11. They yield Klose,Ronaldo,G Müller,Fontaine,Pelé,Klinsmann,Kocsis, so the result has 7 tuples. The query does not say DISTINCT, but these seven selected player values are distinct anyway. Empty ALL and empty ANY behave differently.

