Skip to content
Advertisement

Understanding use of where in subqueries

List the name and continent of countries in the continents containing either Argentina or Australia. Order by name of the country.

enter image description here

From https://sqlzoo.net/wiki/SELECT_within_SELECT_Tutorial, question 3

This is what I tried

Thought it was about equivalence, so tried this

and this seems to be the solution

I’m trying to understand the logical flaw in my solution.

Advertisement

Answer

Becasue subquery in your first result will return multiple rows, and you can’t use equal sign there so you have to check ‘in’ clause.

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement